Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Convert to utf8

by choroba (Canon)
on Mar 01, 2013 at 18:04 UTC ( #1021310=note: print w/ replies, xml ) Need Help??


in reply to Convert to utf8

Open the file with its original encoding for reading, open a new file with utf-8 for writing. Then just read the input line by line and output each line to the new file:

my $enc = 'cp1252'; open my $IN, "<:encoding($enc)", 'input.txt' or die $!; open my $OUT, '>:utf8', 'output.txt' or die $!; print $OUT $_ while <$IN>; close $OUT;
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: Convert to utf8
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2015-07-31 07:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (275 votes), past polls