summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-12 11:49:05 (GMT)
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-12 11:49:05 (GMT)
commitf4b913484295f4e44d21098ae98680d39c8d948f (patch)
tree33c7602001afe17d0c23dcb879849d8c52a6dfb7 /hash.c
parent512db219006842ff6b277efd8f5ebe15e8a86d8f (diff)
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
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index 3d16b4d..60c491f 100644
--- a/hash.c
+++ b/hash.c
@@ -3070,8 +3070,15 @@ extern char **environ;
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