[TODO] support 'U' format in Array#pack()
Reported by kwatch | February 24th, 2008 @ 01:51 AM | in 1.0 preview
Array#pack() doesn't support 'U' (unicode) format currently.
hoge.rb:
str = [0x65e5, 0x672c, 0x8a9e].pack('U*')
p str
puts str
result:
$ ruby hoge.rb
"\346\227\245\346\234\254\350\252\236"
日本語
$ shotgun/rubinius hoge.rb
An exception has occurred:
Unknown kind U (ArgumentError)
Backtrace:
Array#pack {} at kernel/core/array.rb:1148
Array#each at kernel/core/array.rb:573
Array#pack at kernel/core/array.rb:908
Object#__script__ at /tmp/hoge.rb:2
CompiledMethod#as_script at kernel/core/compiled_method.rb:210
Compile.single_load at kernel/core/compile.rb:230
Compile.load_from_extension at kernel/core/compile.rb:302
Object#__script__ at kernel/loader.rb:189
Comments and changes to this ticket
-

Adam Shelly February 27th, 2008 @ 01:14 AM
Here's a patch to update the specs and add 'U' support
Spec and array are in same patch, sorry.
note that the failing specs are due to String#unpack being too strict, at least compared to MRI.
-
Brian Ford February 27th, 2008 @ 03:18 AM
- → State changed from new to resolved
Committed in b239a3b. Thanks!
-

Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
