diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-30 14:36:18 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-30 14:36:18 +0000 |
commit | 14b8c2d598875f8d32844f0363422f14abd53459 (patch) | |
tree | 249068cccd4081da7eb757e3a0264da586cc1265 | |
parent | 43a9c5a36470224bea23acb42339735efc27702b (diff) |
merges r20057 from trunk into ruby_1_9_1.
* pack.c (pack_pack): templates a, A, Z should propagate encoding
of original strings. templates b, B, h, H brings ASCII-8BIT to
the result.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | pack.c | 11 |
2 files changed, 15 insertions, 2 deletions
@@ -10,6 +10,12 @@ Thu Oct 30 14:45:45 2008 Martin Duerst <duerst@it.aoyama.ac.jp> * enc/trans/iso-8859-1-tbl.rb: new file to avoid having to treat ISO-8859-1 as special +Thu Oct 30 14:10:46 2008 Yukihiro Matsumoto <matz@ruby-lang.org> + + * pack.c (pack_pack): templates a, A, Z should propagate encoding + of original strings. templates b, B, h, H brings ASCII-8BIT to + the result. + Thu Oct 30 09:31:45 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * encoding.c (rb_locale_encoding): makes an alias for locale. @@ -519,8 +519,15 @@ pack_pack(VALUE ary, VALUE fmt) ptr = RSTRING_PTR(from); plen = RSTRING_LEN(from); OBJ_INFECT(res, from); - enc = rb_enc_compatible(res, from); - rb_enc_associate(res, enc); + switch (type) { + case 'a': case 'A': case 'Z': + enc = rb_enc_compatible(res, from); + rb_enc_associate(res, enc); + break; + default: + rb_enc_associate(res, rb_ascii8bit_encoding()); + break; + } } if (p[-1] == '*') |