There's more than one way to do things | |
PerlMonks |
issue with reading IO::Uncompress:Gunzip and utf-8by Skeeve (Parson) |
on Aug 25, 2020 at 10:24 UTC ( [id://11121073]=perlquestion: print w/replies, xml ) | Need Help?? |
Skeeve has asked for the wisdom of the Perl Monks concerning the following question:
I have an issue with reading a gzipped UTF-8 encoded file.
Here is an example: preparation: put an umlaut into a file and gzip it. Also
Now check the difference :(
Output Uncompressed: ü 252 Compressed: ü 195 In theory there shouldn't be a difference between the outputs :( Update: I learned that "binmode" won't do anything to the IO::Uncompress::Gunzip filehandle. Handling the decode myself, not relying on an IO-layer, gives the expected result:
Update: As suggested by Corion I'm now using PerlIO::gzip. My Original code, note the test example shown here, now is:
s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{% +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e
Back to
Seekers of Perl Wisdom
|
|