mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
291809f473
commit
0d49737b4f
2 changed files with 9 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
Sat Jun 5 01:20:14 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_buf_cat_escaped_char): defined.
|
||||
|
|
4
string.c
4
string.c
|
@ -7078,12 +7078,14 @@ sym_inspect(VALUE sym)
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue