1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
use strict; use warnings; use utf8; use Encode; open (FILE, "<test.csv"); my @FileOriginal = <FILE>; close (FILE); open (FILE, ">test2.csv"); foreach (@FileOriginal) { my $ucs2 = encode("UCS-2LE", $_); my $utf8 = decode("UTF8", $ucs2); print FILE $utf8."\n"; } close (FILE);
Wide character in print
1 2 3 4 5 6 7 8 9
use strict; use warnings; open my $in, "<:encoding(UCS-2LE)", "test.csv" or die $!; open my $out, ">:encoding(UTF-8)", "test2.csv" or die $!; while ( my $line = <$in> ) { print $out $line; }