Skeeve has asked for the wisdom of the Perl Monks concerning the following question:
This is a follow up of my Lost in encodings question.
Thanks to the answers given there I was able to solve that issue, but now I'm clueless again as I now need to read in compressed (gzip) UTF-8 files and I do not know how to convince perl to read them as UTF-8.
My code for opening the files is:
open my $in, '<:utf8', $filename or die "Can't read $filename: $!\ +n"; if ($filename=~/\.gz$/) { $in= new IO::Uncompress::Gunzip $in, { AutoClose => 1 }; }
When reading uncompressed data, it works fine as I could verify with the help given in my previous thread. I did so by setting the debugger to UTF-8. When reading uncompressed data the Umlaut "ü" is correctly displayed as "ü". When reading the same data from a compressed file the "ü" is displayed as "ü".
I have no idea how to make perl consider the compressed data as UTF-8?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Lost in compressed encodings
by Corion (Patriarch) on Apr 06, 2020 at 08:41 UTC | |
by Skeeve (Parson) on Apr 06, 2020 at 08:53 UTC | |
by Corion (Patriarch) on Apr 06, 2020 at 08:59 UTC | |
by Skeeve (Parson) on Apr 06, 2020 at 09:19 UTC | |
by Tux (Canon) on Apr 06, 2020 at 10:49 UTC | |
Re: Lost in compressed encodings
by jo37 (Curate) on Apr 06, 2020 at 16:23 UTC | |
Re: Lost in compressed encodings
by Anonymous Monk on Apr 07, 2020 at 16:46 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |