in reply to Re^3: Lost in compressed encodings
in thread Lost in compressed encodings
Thanks for all your suggestions, Corion.
As my usecase is a module which reads a (kind of) CSV file, there are just 2 places, where I read a line from the file.
So I decied to do the "manual" decoding:
open my $in, '<:raw', $filename or die "Can't read $filename: $!\n"; if ($filename=~/\.gz$/) { $in= new IO::Uncompress::Gunzip $in, { AutoClose => 1 }; } # later on $_= <$in>; chomp; @headers= split /\t/, lc decode('UTF-8' => $_); # That's not really required as the header will always be # ASCII-characters… But for completeness sake… # further down I have a loop while (<$in>) { chomp; # … @line{@headers}= split /\t/, decode('UTF-8' => $_);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Lost in compressed encodings
by Tux (Canon) on Apr 06, 2020 at 10:49 UTC |