ruby-changes:8523
From: matz <ko1@a...>
Date: Thu, 30 Oct 2008 18:19:27 +0900 (JST)
Subject: [ruby-changes:8523] Ruby:r20057 (trunk): * pack.c (pack_pack): templates a, A, Z should propagate encoding
matz 2008-10-30 18:19:13 +0900 (Thu, 30 Oct 2008) New Revision: 20057 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20057 Log: * 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. Modified files: trunk/ChangeLog trunk/pack.c Index: ChangeLog =================================================================== --- ChangeLog (revision 20056) +++ ChangeLog (revision 20057) @@ -6,6 +6,12 @@ * 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@r...> + + * 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 10:34:20 2008 Nobuyoshi Nakada <nobu@r...> * ruby.c (moreswitches): splits option string and passes arguments. Index: pack.c =================================================================== --- pack.c (revision 20056) +++ pack.c (revision 20057) @@ -519,8 +519,15 @@ 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] == '*') -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/