Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Encoding and decoding a Unicode

by andal (Hermit)
on Jul 13, 2015 at 07:25 UTC ( #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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2023-03-25 11:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (63 votes). Check out past polls.

    Notices?