summaryrefslogtreecommitdiffstats
path: root/sprintf.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-13 02:00:30 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-13 02:00:30 +0000
commitb4414c0ed5c202540ee542cdf93b7870ddb6c17d (patch)
treed71f869776134612d8618871000b41ab43e7a246 /sprintf.c
parent5e5ddc62e483de5526a576aa3bd58045e9c1bea0 (diff)
downloadruby-b4414c0ed5c202540ee542cdf93b7870ddb6c17d.tar.gz
ruby-b4414c0ed5c202540ee542cdf93b7870ddb6c17d.tar.xz
ruby-b4414c0ed5c202540ee542cdf93b7870ddb6c17d.zip
* sprintf.c (rb_str_format): check encoding compatibility only on
real parts. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sprintf.c b/sprintf.c
index 9f3183a0e..2bcf138c2 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -660,7 +660,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
str = rb_obj_as_string(arg);
if (OBJ_TAINTED(str)) tainted = 1;
len = RSTRING_LEN(str);
- enc = rb_enc_check(result, str);
+ enc = rb_enc_check(rb_str_substr(result, 0, blen), str);
if (flags&(FPREC|FWIDTH)) {
slen = rb_enc_strlen(RSTRING_PTR(str),RSTRING_END(str),enc);
if (slen < 0) {