|Problems? Is your data what you think it is?|
Unicode Puzzleby Skeeve (Vicar)
|on Aug 12, 2010 at 21:16 UTC||Need Help??|
Skeeve has asked for the
wisdom of the Perl Monks concerning the following question:
Hi! I'm a bit puzzled. I'm runnning a file through openssl to decode it. A portion of the output, in which I'm interested, is said to be "in Unicode, padded with 00".
So when I look at it in a hexdump, it reads like this:
There are several strings of bytes which I read from openssl's output. I unpack them into an array. Demo code could be something like this:
So now I wonder how to convert the bytestrings in @unpacked to proper perl strings which I can print out without the \x00. Additionally I'd like to remove the padded zeroes.
I tried to use decode_utf8 and decode("utf16", ...) on them, but the first one did not seem to have any impact and the latter one fails with (example) "UTF-16:Unrecognised BOM 4d"
Does anyone of you have a hint what I'm doing wrong?