ruby-changes:30919
From: nobu <ko1@a...>
Date: Sat, 21 Sep 2013 00:47:53 +0900 (JST)
Subject: [ruby-changes:30919] nobu:r42998 (trunk): string.c: scan coderange
nobu 2013-09-21 00:47:46 +0900 (Sat, 21 Sep 2013) New Revision: 42998 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42998 Log: string.c: scan coderange * string.c (rb_str_conv_enc_opts): make sure to scan coderange to get rid of unnecessary conversion. Modified files: trunk/ChangeLog trunk/string.c Index: ChangeLog =================================================================== --- ChangeLog (revision 42997) +++ ChangeLog (revision 42998) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Sep 21 00:47:44 2013 Nobuyoshi Nakada <nobu@r...> + + * string.c (rb_str_conv_enc_opts): make sure to scan coderange to get + rid of unnecessary conversion. + Sat Sep 21 00:21:08 2013 Zachary Scott <e@z...> * ext/openssl/lib/openssl/ssl.rb: [DOC] Document OpenSSL::SSLServer Index: string.c =================================================================== --- string.c (revision 42997) +++ string.c (revision 42998) @@ -554,7 +554,7 @@ rb_str_conv_enc_opts(VALUE str, rb_encod https://github.com/ruby/ruby/blob/trunk/string.c#L554 if (!to) return str; if (!from) from = rb_enc_get(str); if (from == to) return str; - if ((rb_enc_asciicompat(to) && ENC_CODERANGE(str) == ENC_CODERANGE_7BIT) || + if ((rb_enc_asciicompat(to) && is_ascii_string(str)) || to == rb_ascii8bit_encoding()) { if (STR_ENC_GET(str) != to) { str = rb_str_dup(str); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/