Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Encoding and decoding a Unicode

by andal (Hermit)
on Jul 13, 2015 at 07:25 UTC ( [id://1134456]=note: print w/replies, xml ) Need Help??

in reply to Encoding and decoding a Unicode

First of all, there's small bug in your code. When you pass content of the file through decoding process (via 'encoding' directive), you get "characters". You should not pass those characters to STDOUT, because by default it expects "octets" instead of "characters". Well, it kinda works if your text contains only English alphabet, but it won't work properly for other characters.

Second, your question is not clear. In the second block of code you use '$currentline', which is also used in the first block, is it the same variable, or different one? Maybe you can provide real block of code that produces problems, then it would be possible to see where you make mistake. Otherwise, as already recommended, try to read 'perldoc Encode'.

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-07-21 14:45 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.