ruby-changes:46572
From: usa <ko1@a...>
Date: Fri, 12 May 2017 20:49:14 +0900 (JST)
Subject: [ruby-changes:46572] usa:r58687 (trunk): Encoding.default_internal should affect ENV on Windows like other platforms
usa 2017-05-12 20:49:05 +0900 (Fri, 12 May 2017) New Revision: 58687 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58687 Log: Encoding.default_internal should affect ENV on Windows like other platforms * hash.c (env_str_transcode): call rb_external_str_with_enc() if default_internal is available. Modified files: trunk/hash.c Index: hash.c =================================================================== --- hash.c (revision 58686) +++ hash.c (revision 58687) @@ -3070,8 +3070,15 @@ extern char **environ; https://github.com/ruby/ruby/blob/trunk/hash.c#L3070 static VALUE env_str_transcode(VALUE str, rb_encoding *enc) { - return rb_str_conv_enc_opts(str, NULL, enc, - ECONV_INVALID_REPLACE | ECONV_UNDEF_REPLACE, Qnil); + rb_encoding *internal = rb_default_internal_encoding(); + if (!internal) { + return rb_str_conv_enc_opts(str, NULL, enc, + ECONV_INVALID_REPLACE | ECONV_UNDEF_REPLACE, + Qnil); + } + else { + return rb_external_str_with_enc(str, rb_utf8_encoding()); + } } #endif -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/