Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: Lost in encodings

by LanX (Cardinal)
on Feb 08, 2020 at 18:15 UTC ( #11112635=note: print w/replies, xml ) Need Help??


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. ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11112635]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2020-11-27 15:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?