1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2017-05-12 11:49:05 +00:00
parent 512db21900
commit f4b9134842

11
hash.c
View file

@ -3070,8 +3070,15 @@ extern char **environ;
static VALUE static VALUE
env_str_transcode(VALUE str, rb_encoding *enc) env_str_transcode(VALUE str, rb_encoding *enc)
{ {
return rb_str_conv_enc_opts(str, NULL, enc, rb_encoding *internal = rb_default_internal_encoding();
ECONV_INVALID_REPLACE | ECONV_UNDEF_REPLACE, Qnil); 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 #endif