diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-24 02:49:51 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-24 02:49:51 +0000 |
commit | 004ce53b25beace0e60280696ecca6b5da8bd727 (patch) | |
tree | 708dee0de4841da33e969e5269b55f3022808ae3 /time.c | |
parent | dcc004cba9ebb784bad46bdb35f92edcb113a115 (diff) | |
download | ruby-004ce53b25beace0e60280696ecca6b5da8bd727.tar.gz |
time.c: locale time zone name
* time.c (time_zone_name): should be US-ASCII only if all 7-bits,
otherwise locale encoding. [ruby-core:68230] [Bug #10887]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -4194,10 +4194,13 @@ time_isdst(VALUE time) static VALUE time_zone_name(const char *zone) { - VALUE name = rb_usascii_str_new_cstr(zone); /* zone may be ASCII-8BIT on Windows */ + VALUE name = rb_str_new_cstr(zone); if (!rb_enc_str_asciionly_p(name)) { name = rb_external_str_with_enc(name, rb_locale_encoding()); } + else { + rb_enc_associate(name, rb_usascii_encoding()); + } return name; } |