ruby-changes:16210
From: naruse <ko1@a...>
Date: Sat, 5 Jun 2010 20:32:13 +0900 (JST)
Subject: [ruby-changes:16210] Ruby:r28176 (trunk): * string.c (sym_inspect): Escape when the symbol is not
naruse 2010-06-05 20:31:58 +0900 (Sat, 05 Jun 2010) New Revision: 28176 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28176 Log: * string.c (sym_inspect): Escape when the symbol is not resulted encoding and not ascii_only. It had escaped ascii-incompatible string, but it is wrong. Modified files: trunk/ChangeLog trunk/string.c Index: ChangeLog =================================================================== --- ChangeLog (revision 28175) +++ ChangeLog (revision 28176) @@ -1,3 +1,9 @@ +Sat Jun 5 01:20:14 2010 NARUSE, Yui <naruse@r...> + + * string.c (sym_inspect): Escape when the symbol is not + resulted encoding and not ascii_only. It had escaped + ascii-incompatible string, but it is wrong. + Sat Jun 5 01:10:12 2010 NARUSE, Yui <naruse@r...> * string.c (rb_str_buf_cat_escaped_char): defined. Index: string.c =================================================================== --- string.c (revision 28175) +++ string.c (revision 28176) @@ -7078,12 +7078,14 @@ const char *ptr; long len; char *dest; + rb_encoding *resenc = rb_default_internal_encoding(); + if (resenc == NULL) resenc = rb_default_external_encoding(); sym = rb_id2str(id); enc = STR_ENC_GET(sym); ptr = RSTRING_PTR(sym); len = RSTRING_LEN(sym); - if (!rb_enc_asciicompat(enc) || len != (long)strlen(ptr) || + if ((resenc != enc && !rb_str_is_ascii_only_p(sym)) || len != (long)strlen(ptr) || !rb_enc_symname_p(ptr, enc) || !sym_printable(ptr, ptr + len, enc)) { str = rb_str_inspect(sym); len = RSTRING_LEN(str); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/