summaryrefslogtreecommitdiffstats
path: root/pack.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-06 05:37:20 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-06 05:37:20 +0000
commit2efa2847079c55018bf36174c45384e247bb22c6 (patch)
tree69da53a521c671861657552c4bbe0a0cf8d6bf57 /pack.c
parent5cc9883c5edb477fc95c6f2f292b74247cd808c2 (diff)
downloadruby-2efa2847079c55018bf36174c45384e247bb22c6.tar.gz
ruby-2efa2847079c55018bf36174c45384e247bb22c6.tar.xz
ruby-2efa2847079c55018bf36174c45384e247bb22c6.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@20563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pack.c b/pack.c
index c4ee6dbb3..8d0a70473 100644
--- a/pack.c
+++ b/pack.c
@@ -921,6 +921,7 @@ 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 */
@@ -928,6 +929,7 @@ pack_pack(VALUE ary, VALUE fmt)
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 */
@@ -1886,6 +1888,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 +1917,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;