http://qs321.pair.com?node_id=11112635


in reply to Re^3: Lost in encodings
in thread Lost in encodings

Hi again Harald

> A decent print unpack 'H*',$data does the same with less fuss.

Actually, why should I bother to spot the non-ASCII between all the hex-codes? °

Please compare

DB<50> $data = 'Künzler' DB<51> print unpack 'H*',$data 4b816e7a6c6572 # ORLY? DB<52> use Data::Dump qw/pp dd/ DB<53> dd $data "K\x81nzler" # <--- DB<54> use Devel::Peek DB<55> Dump $data SV = PVNV(0xd9adb8) at 0x351ac30 REFCNT = 1 FLAGS = (POK,IsCOW,pIOK,pNOK,pPOK) IV = 0 NV = 0 PV = 0x355bcd8 "K\201nzler"\0 # <--- CUR = 7 LEN = 10 COW_REFCNT = 2 DB<56>

Hint: this time not UTF8, did you notice easily?

Devel::Peek is core and shows multiple relevant infos in one command.

It has some minor disadvantages, but if the OP had shown us the output we'd knew immediately that his code is correct, except the debugger settings.

Telling people explicitly not to use it is pretty surprising ...

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

°) yes I know that ASCII is below 0x80 and how to spot utf8 multi-bytes. But do others?

And normally I use a water heater when I need tea and don't start to collect decent wood in the forest. ;-)