mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
e2273eac85
commit
e41fb7d4ae
2 changed files with 10 additions and 2 deletions
|
@ -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>
|
Tue Dec 9 03:21:37 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* mkconfig.rb: fix for continued lines. based on a patch from
|
* mkconfig.rb: fix for continued lines. based on a patch from
|
||||||
|
|
6
pack.c
6
pack.c
|
@ -898,6 +898,8 @@ pack_pack(VALUE ary, VALUE fmt)
|
||||||
|
|
||||||
case 'u': /* uuencoded string */
|
case 'u': /* uuencoded string */
|
||||||
case 'm': /* base64 encoded 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;
|
from = NEXTFROM;
|
||||||
StringValue(from);
|
StringValue(from);
|
||||||
ptr = RSTRING_PTR(from);
|
ptr = RSTRING_PTR(from);
|
||||||
|
@ -923,15 +925,15 @@ pack_pack(VALUE ary, VALUE fmt)
|
||||||
plen -= todo;
|
plen -= todo;
|
||||||
ptr += todo;
|
ptr += todo;
|
||||||
}
|
}
|
||||||
ENCODING_CODERANGE_SET(res, rb_usascii_encindex(), ENC_CODERANGE_7BIT);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'M': /* quoted-printable encoded string */
|
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);
|
from = rb_obj_as_string(NEXTFROM);
|
||||||
if (len <= 1)
|
if (len <= 1)
|
||||||
len = 72;
|
len = 72;
|
||||||
qpencode(res, from, len);
|
qpencode(res, from, len);
|
||||||
ENCODING_CODERANGE_SET(res, rb_usascii_encindex(), ENC_CODERANGE_7BIT);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P': /* pointer to packed byte string */
|
case 'P': /* pointer to packed byte string */
|
||||||
|
|
Loading…
Add table
Reference in a new issue