CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
deconding and encoding: utf8 and ansi

 



limner
Novice

Feb 25, 2014, 8:10 AM

Post #1 of 2 (1052 views)
deconding and encoding: utf8 and ansi Can't Post

Hi to all

i've a little problem about an argument about never known much....utf8 and other caracther sets...

i need to convert an utf8 textfile to a standard ansi file, i found some solutions but usually perl give me some errors, and i would like to avoid them.

the second problem i had is that it seem to be some invisible characther in the decoded file that i don't know how to andle...

this is the code i used:

$FILE_TEMP="nomefile.temp";
$FILE_DEF ="nomefile.def";
open my $INFILE ,'<:utf8' ,$FILE_TEMP;
open my $OUTFILE ,'>:encoding(iso-8859-1)' ,$FILE_DEF;
while (my $line = <$INFILE>) {
print $OUTFILE $line;
}
close INFILE;
close OUTFILE;

Any help?

P.S.
i think that maybe there is a more correct way to convert, like a function...


Zhris
Enthusiast

Mar 1, 2014, 1:59 PM

Post #2 of 2 (1030 views)
Re: [limner] deconding and encoding: utf8 and ansi [In reply to] Can't Post

Hi,

Could you possibly attach an example input file ( nomefile.temp ) in order for us to replicate the issue you have encountered.

Regards,

Chris

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives