summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-14 03:02:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-14 03:02:57 +0000
commitc53470fd47fa62eed38af281017e10a41ef8ff2a (patch)
treec5db8fad2a8b3bfaf2d5151b0c07594096478e8f /sprintf.c
parentf2aa0fd5d4ffa77a5c4bdd8698ac774b20540c62 (diff)
downloadruby-c53470fd47fa62eed38af281017e10a41ef8ff2a.tar.gz
* sprintf.c (rb_enc_vsprintf): relaxed the restriction. since the
implementation deeply depends on plain char, so wchar_t based encodings are not supported. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sprintf.c b/sprintf.c
index bae6c146ac..c34d906310 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -1169,8 +1169,9 @@ rb_enc_vsprintf(rb_encoding *enc, const char *fmt, va_list ap)
f._w = 120;
result = rb_str_buf_new(f._w);
if (enc) {
- if (!rb_enc_asciicompat(enc)) {
- rb_raise(rb_eArgError, "cannot construct ASCII-incompatible encoding string: %s",
+ if (rb_enc_mbminlen(enc) > 1) {
+ /* the implementation deeply depends on plain char */
+ rb_raise(rb_eArgError, "cannot construct wchar_t based encoding string: %s",
rb_enc_name(enc));
}
rb_enc_associate(result, enc);