From: "Martin J. Dürst" Date: 2009-09-28T19:58:06+09:00 Subject: [ruby-dev:39388] Re: [ruby-cvs:32331] Ruby:r25113 (trunk): String#inspect's encoding should be fixed. 成瀬さん、こんにちは。 On 2009/09/27 5:17, naruse@ruby-lang.org wrote: > naruse 2009-09-27 05:17:52 +0900 (Sun, 27 Sep 2009) > > New Revision: 25113 > > http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25113 > > Log: > String#inspect's encoding should be fixed. > > * string.c (rb_str_inspect): result's encoding should be fixed. > If default_internal is not nil, the encoding is default_internal. > Else if default_external is not nil, the encoding is default_external. > But the encoding is not ASCII-compatible, the encoding is replaced by > US-ASCII. > Characters in ASCII-incompatible encoding or non ASCII characters > in other than the encoding will be \xXX escaped. \xXX にしてしまうとどんな文字だったのかという情報がなくなってしまいま す。\uHHHH にしたらどうでしょうか。バイトの値から文字を再現するのは多く の場合不可能ではないが、非常に面倒くさいので出来れば避けていただきたいです。 よろしくお願いします。 Martin. > * string.c (str_buf_cat2): defined. > > * string.c (prefix_escape): removed. > > Modified files: > trunk/ChangeLog > trunk/string.c > > -- #-# Martin J. Dürst, Professor, Aoyama Gakuin University #-# http://www.sw.it.aoyama.ac.jp mailto:duerst@it.aoyama.ac.jp