in reply to Re: CSV nightmare
in thread CSV nightmare
Text::CSV might soon be extended with a layer that deals with encodings, somewhat like this:
use Text::CSV::Encoded; my $csv = Text::CSV::Encoded->new ({ encoding => "utf-8", # Both in and out encoding_in => "utf-16le", # Only the input encoding_out => "cp1252", # Only the output });
Until then, I think
binmode STDOUT, ":utf8"; my $csv = Text::CSV_XS->new ({ binary => 1 }); open my $fh, "<:encoding(utf-16le)", $file or die "$file: $!"; while (my $row = $csv->getline ($fh)) { print $row->[4]; }
should work
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: CSV nightmare (utf8 w/ csv_xs)
by ikegami (Patriarch) on Jun 03, 2008 at 10:36 UTC | |
by Tux (Canon) on Jun 03, 2008 at 15:10 UTC | |
by ikegami (Patriarch) on Jun 03, 2008 at 19:26 UTC | |
by ikegami (Patriarch) on Jun 04, 2008 at 23:19 UTC | |
by Tux (Canon) on Jun 05, 2008 at 05:33 UTC |