diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-22 03:16:52 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-22 03:16:52 +0000 |
commit | 6c614a086387f23fb3ad4367dd2572ae3a0983e7 (patch) | |
tree | 5b5a4bbcd3a3c918155b6c9043908857fada77fa | |
parent | 316b30d0d9071a9895cb246015da07e1ec12132b (diff) | |
download | ruby-6c614a086387f23fb3ad4367dd2572ae3a0983e7.tar.gz ruby-6c614a086387f23fb3ad4367dd2572ae3a0983e7.tar.xz ruby-6c614a086387f23fb3ad4367dd2572ae3a0983e7.zip |
* string.c (rb_str_inspect): string of ascii incompatible encoding
should be escaped and returned as US-ASCII encoding.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | string.c | 1 |
2 files changed, 6 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Fri Feb 22 12:11:12 2008 NARUSE, Yui <naruse@ruby-lang.org> + + * string.c (rb_str_inspect): string of ascii incompatible encoding + should be escaped and returned as US-ASCII encoding. + Fri Feb 22 11:16:55 2008 NARUSE, Yui <naruse@ruby-lang.org> * string.c (rb_str_substr): copy encoding although empty string. @@ -3663,6 +3663,7 @@ rb_str_inspect(VALUE str) char *p, *pend; VALUE result = rb_str_buf_new2(""); + if (!rb_enc_asciicompat(enc)) enc = rb_usascii_encoding(); rb_enc_associate(result, enc); str_cat_char(result, '"', enc); p = RSTRING_PTR(str); pend = RSTRING_END(str); |