summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-25 23:24:33 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-25 23:24:33 +0000
commit4544b3824c8ce74e0a92c58a3167f900904f506b (patch)
treea1a44d418b10817e48074fed532a8969a07a5a17 /time.c
parenta6e30a87140512445892d464b841a8ef60e0d012 (diff)
* time.c (strftimev): Make Time#to_s default to US-ASCII encoding but
respect Encoding.default_internal. [ruby-core:39092] * test/ruby/test_time.rb (class TestTime): Corresponding test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/time.c b/time.c
index ebe0ab9..fbd0ecf 100644
--- a/time.c
+++ b/time.c
@@ -4347,6 +4347,8 @@ strftimev(const char *fmt, VALUE time)
MAKE_TM(time, tobj);
len = rb_strftime_alloc(&buf, fmt, &tobj->vtm, tobj->timew, TIME_UTC_P(tobj));
str = rb_str_new(buf, len);
+ rb_enc_associate_index(str, rb_usascii_encindex());
+ str = rb_str_export_to_enc(str, rb_default_internal_encoding());
if (buf != buffer) xfree(buf);
return str;
}