diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-12 14:53:00 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-12 14:53:00 +0000 |
commit | 87f30b70a623dc2c8b31d03c32299d6a46e3946e (patch) | |
tree | 06789993f370ec0249d8ed92507d0a7a33b175e1 /pack.c | |
parent | 8042a5b6d656d3e83c4986c0fcf8bcadaa38eada (diff) |
merges r20563 and r20588 from trunk into ruby_1_9_1.
* pack.c (pack_pack): set US-ASCII and CODERANGE_7BIT
when quoted-printable ('M') and base64 ('m').
[ruby-dev:37284]
* pack.c (pack_unpack): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r-- | pack.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -896,6 +896,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); @@ -924,6 +926,8 @@ pack_pack(VALUE ary, VALUE fmt) 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; @@ -1886,6 +1890,7 @@ pack_unpack(VALUE str, VALUE fmt) } } rb_str_set_len(buf, ptr - RSTRING_PTR(buf)); + ENCODING_CODERANGE_SET(buf, rb_usascii_encindex(), ENC_CODERANGE_7BIT); UNPACK_PUSH(buf); } break; @@ -1914,6 +1919,7 @@ pack_unpack(VALUE str, VALUE fmt) s++; } rb_str_set_len(buf, ptr - RSTRING_PTR(buf)); + ENCODING_CODERANGE_SET(buf, rb_usascii_encindex(), ENC_CODERANGE_7BIT); UNPACK_PUSH(buf); } break; |