summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-31 03:18:30 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-31 03:18:30 +0000
commit1ff0d08b200abd769978038e84afe656934ef361 (patch)
tree04713cba6da6985401a20565ee3f1be58ff30ba1
parent60d976b3ddbbb77f378c34f6633efb2cf4331d15 (diff)
merges r29851 from trunk into ruby_1_9_2.
-- * time.c (time_zone): use rb_locale_str_new_cstr to set encoding as locale and convert its content to internal encoding. [ruby-core:33278] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--test/ruby/test_time.rb2
-rw-r--r--time.c4
-rw-r--r--version.h2
4 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 5eda90ccc7..8923b8c737 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Nov 22 14:22:45 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * time.c (time_zone): use rb_locale_str_new_cstr to set encoding
+ as locale and convert its content to internal encoding.
+ [ruby-core:33278]
+
Fri Jan 14 14:01:12 2011 NARUSE, Yui <naruse@ruby-lang.org>
* pack.c (pack_unpack): the resulted string of unpack('M') must have
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index 520d15971c..ec5395092f 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -469,6 +469,7 @@ class TestTime < Test::Unit::TestCase
assert_equal(1, T2000.yday)
assert_equal(false, T2000.isdst)
assert_equal("UTC", T2000.zone)
+ assert_equal(Encoding.find("locale"), T2000.zone.encoding)
assert_equal(0, T2000.gmt_offset)
assert(!T2000.sunday?)
assert(!T2000.monday?)
@@ -490,6 +491,7 @@ class TestTime < Test::Unit::TestCase
assert_equal(t.yday, Time.at(946684800).yday)
assert_equal(t.isdst, Time.at(946684800).isdst)
assert_equal(t.zone, Time.at(946684800).zone)
+ assert_equal(Encoding.find("locale"), Time.at(946684800).zone.encoding)
assert_equal(t.gmt_offset, Time.at(946684800).gmt_offset)
assert_equal(t.sunday?, Time.at(946684800).sunday?)
assert_equal(t.monday?, Time.at(946684800).monday?)
diff --git a/time.c b/time.c
index 2e53170151..463bf6e609 100644
--- a/time.c
+++ b/time.c
@@ -4151,11 +4151,11 @@ time_zone(VALUE time)
MAKE_TM(time, tobj);
if (TIME_UTC_P(tobj)) {
- return rb_str_new2("UTC");
+ return rb_obj_untaint(rb_locale_str_new_cstr("UTC"));
}
if (tobj->vtm.zone == NULL)
return Qnil;
- return rb_str_new2(tobj->vtm.zone);
+ return rb_obj_untaint(rb_locale_str_new_cstr(tobj->vtm.zone));
}
/*
diff --git a/version.h b/version.h
index 8d00c9b724..f566990411 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 268
+#define RUBY_PATCHLEVEL 269
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1