in reply to issue with reading IO::Uncompress:Gunzip and utf-8
Gzip doesn't seem to store the encoding information, so you'll have to decode() the result.
perl -e ' use IO::Uncompress::Gunzip; use Encode; binmode(STDOUT, ":utf8"); open my $in, "<:utf8", "umlaut"; $_=<$in>; print "Uncompressed: $_ ",ord($_),"\n"; my $gin= IO::Uncompress::Gunzip->new("umlaut.gz"); binmode($gin, ":utf8"); $_=<$gin>; print " Compressed: $_ ",ord($_),"\n"; $_ = decode("utf-8", $_); print " Decoded: $_ ",ord($_),"\n"; '
Output:
Uncompressed: ü 252 Compressed: ü 195 Decoded: ü 252
|
---|
In Section
Seekers of Perl Wisdom