Hi,

2009/10/9 Yukihiro Matsumoto <matz / ruby-lang.org>:
> |Array#pack with format 'H' seems to accept not only alphabet A-F but
> |also G-Z.  Is it a spec, or bug?
> |
> |  ["0D"].pack("H*").unpack("C") #=> [13]
> |  ["0E"].pack("H*").unpack("C") #=> [14]
> |  ["0F"].pack("H*").unpack("C") #=> [15]
> |  ["0G"].pack("H*").unpack("C") #=> [0]
> |  ["0H"].pack("H*").unpack("C") #=> [1]
> |  ["0I"].pack("H*").unpack("C") #=> [2]
> |  ["0J"].pack("H*").unpack("C") #=> [3]
>
> It must be a bug.


Thank you for answering my question.
But after that, I realized that the format 'B' behaved in a similar
way:

  ["00100001"].pack("B*") #=> "!"
  ["00122223"].pack("B*") #=> "!"

In [ruby-dev:37308], you said that this behavior of 'B' is intended
for compatibility to perl.  Is the behavior of 'H' really a bug?


IMO, these behaviors are a little confusing.  It is easy to understand
for both 'B' and 'H' to reject the data if it contains irrelevant
characters.  But unfortunately, compatibility is also important.
I don't know what we should do..

-- 
Yusuke ENDOH <mame / tsg.ne.jp>