summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-09 02:51:10 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-09 02:51:10 +0000
commite41fb7d4ae6a421d0950201864817ef6cd892b82 (patch)
treed2648057fa097ec7b0378e3da3bbe688fe460143
parente2273eac85d03b504242c14b642778936f03f585 (diff)
* 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'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--pack.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3fae684..023416f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Dec 9 11:50:46 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * 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@ruby-lang.org>
* mkconfig.rb: fix for continued lines. based on a patch from
diff --git a/pack.c b/pack.c
index d910546..8c02f62 100644
--- a/pack.c
+++ b/pack.c
@@ -898,6 +898,8 @@ pack_pack(VALUE ary, VALUE fmt)
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 @@ pack_pack(VALUE ary, VALUE fmt)
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 */