mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* pack.c (pack_pack): 'u0' is not special differently from 'm0'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
343deb4c39
commit
4b983b90c4
3 changed files with 9 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
Sat Dec 6 17:51:35 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||
|
||||
* pack.c (pack_pack): 'u0' is not special differently from 'm0'.
|
||||
|
||||
Sat Dec 6 14:35:06 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* pack.c (pack_pack): set US-ASCII and CODERANGE_7BIT
|
||||
|
|
2
pack.c
2
pack.c
|
@ -901,7 +901,7 @@ pack_pack(VALUE ary, VALUE fmt)
|
|||
ptr = RSTRING_PTR(from);
|
||||
plen = RSTRING_LEN(from);
|
||||
|
||||
if (len == 0) {
|
||||
if (len == 0 && type == 'm') {
|
||||
encodes(res, ptr, plen, type, 0);
|
||||
ptr += plen;
|
||||
break;
|
||||
|
|
|
@ -349,6 +349,10 @@ class TestPack < Test::Unit::TestCase
|
|||
assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u"))
|
||||
assert_equal("&86)C9&5F\n#9VAI\n", ["abcdefghi"].pack("u6"))
|
||||
|
||||
assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u0"))
|
||||
assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u1"))
|
||||
assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u2"))
|
||||
|
||||
assert_equal([""], "".unpack("u"))
|
||||
assert_equal(["a"], "!80``\n".unpack("u"))
|
||||
assert_equal(["abc"], "#86)C\n".unpack("u"))
|
||||
|
|
Loading…
Reference in a new issue