mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
dcc004cba9
commit
004ce53b25
2 changed files with 14 additions and 1 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Tue Feb 24 11:49:48 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* time.c (time_zone_name): should be US-ASCII only if all 7-bits,
|
||||||
|
otherwise locale encoding. [ruby-core:68230] [Bug #10887]
|
||||||
|
|
||||||
|
Tue Feb 24 11:49:43 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* time.c (time_zone_name): should be US-ASCII only if all 7-bits,
|
||||||
|
otherwise locale encoding. [ruby-core:68230] [Bug #10887]
|
||||||
|
|
||||||
Tue Feb 24 09:47:07 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Feb 24 09:47:07 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (chompped_length): enable smart chomp for all non-dummy
|
* string.c (chompped_length): enable smart chomp for all non-dummy
|
||||||
|
|
5
time.c
5
time.c
|
@ -4194,10 +4194,13 @@ time_isdst(VALUE time)
|
||||||
static VALUE
|
static VALUE
|
||||||
time_zone_name(const char *zone)
|
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)) {
|
if (!rb_enc_str_asciionly_p(name)) {
|
||||||
name = rb_external_str_with_enc(name, rb_locale_encoding());
|
name = rb_external_str_with_enc(name, rb_locale_encoding());
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
rb_enc_associate(name, rb_usascii_encoding());
|
||||||
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue