ruby-changes:9051
From: yugui <ko1@a...>
Date: Tue, 9 Dec 2008 11:51:30 +0900 (JST)
Subject: [ruby-changes:9051] Ruby:r20588 (trunk): * pack.c (pack_pck): fixed .
yugui 2008-12-09 11:51:10 +0900 (Tue, 09 Dec 2008) New Revision: 20588 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20588 Log: * pack.c (pack_pck): fixed [ruby-dev:37295]. Array#pack always has returned an US-ASCII string when the given format ended with 'u', 'M' or 'm'. Modified files: trunk/ChangeLog trunk/pack.c Index: ChangeLog =================================================================== --- ChangeLog (revision 20587) +++ ChangeLog (revision 20588) @@ -1,3 +1,9 @@ +Tue Dec 9 11:50:46 2008 Yuki Sonoda (Yugui) <yugui@y...> + + * pack.c (pack_pck): fixed [ruby-dev:37295]. + Array#pack always has returned an US-ASCII string when + the given format ended with 'u', 'M' or 'm'. + Tue Dec 9 03:21:37 2008 Nobuyoshi Nakada <nobu@r...> * mkconfig.rb: fix for continued lines. based on a patch from Index: pack.c =================================================================== --- pack.c (revision 20587) +++ pack.c (revision 20588) @@ -898,6 +898,8 @@ case 'u': /* uuencoded string */ case 'm': /* base64 encoded string */ + enc = rb_enc_compatible(res, rb_enc_from_encoding(rb_usascii_encoding())); + rb_enc_associate(res, enc); from = NEXTFROM; StringValue(from); ptr = RSTRING_PTR(from); @@ -923,15 +925,15 @@ plen -= todo; ptr += todo; } - ENCODING_CODERANGE_SET(res, rb_usascii_encindex(), ENC_CODERANGE_7BIT); break; case 'M': /* quoted-printable encoded string */ + enc = rb_enc_compatible(res, rb_enc_from_encoding(rb_usascii_encoding())); + rb_enc_associate(res, enc); from = rb_obj_as_string(NEXTFROM); if (len <= 1) len = 72; qpencode(res, from, len); - ENCODING_CODERANGE_SET(res, rb_usascii_encindex(), ENC_CODERANGE_7BIT); break; case 'P': /* pointer to packed byte string */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/