in reply to Unpacking Wide Hex Characters
unpack primarily deals with bytes, and H is no exception. Getting the hex representation of the byte "\x{2020}" makes no sense.
ord gets the UNICODE codepoint and sprintf can convert to hex.
sprintf('%x', ord("\x{2020}"))
You can do some nifty stuff with Encode, too.
encode('US-ASCII', "ab\x{2020}cd", Encode::FB_PERLQQ) # ab\x{2020}cd
See other values for the third param.
|
|---|