Martin:
Use Unicode::Lite's convert method (requires Unicode::Map and
Unicode::String to also be installed) to go from Latin-1 to UTF-8. We use a
temp file to first write out the data and then rename it to our input file
name for further processing. Here's a sample:
use Unicode::Lite;
open INFILE,"<input.csv";
open OUTFILE,">output.tmp";
while (<INFILE>) {
chomp;
convert 'latin1', 'utf8', $_;
print OUTFILE "$_\n";
}
close INFILE;
close OUTFILE;
rename ("output.tmp","input.csv");
--
Phil Lembo
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Message: 1
From: Mar...@ml...
To: per...@li...
Date: Tue, 26 Feb 2002 13:44:03 +0100
Subject: Convert ISO8859-1 to UTF8
Hi everybody,
how can i convert an iso8859-x string that is read out of a file into an
utf8
string that is written to a ldap server. i have already used the perlmodule
convert::recode
but it doesn't works... also the command 'recode xxx..xxx file.xy' is no
solution becaus it converts the whole file and not only the needed string...
any help would be welcome
have a nice day
martin
|