|Think about Loose Coupling|
Lost in encodingsby Skeeve (Parson)
|on Feb 07, 2020 at 19:31 UTC||Need Help??|
Skeeve has asked for the wisdom of the Perl Monks concerning the following question:
I'm completely lost in encodings :(
I'm reading data using LWP. When the data contains umlauts, things start to get weird and I get lost.
As the whole script is already very complex, let me try to give examples first before I start thinking about an example script.
For the example I use perl debugger. <&p>
After reading my data one of the strings looks like this:
So I think my issue already starts here as the data I read is displayed correctly but perl treats it as bytes.
I do not know what to do with that string so that perl handles it correctly.
(It was the Questionmark on a square that was displayed). That seemed wrong, but when I tested by reading from an utf-8 file opening it with '<:utf8' I got the same result, so obviously it's correct that way.
So as a test I changed my string here by decoding it as utf8.
In the next step, the string is handed to MIME::Lite::TT::HTML and by that to Text::Table. Finally it's send to me by mail.
When I look at the mail's source, the umlaut is (quoted printable) represented by '=FC' and, unfortunately, displayed as a questionmark in a square :(
I know I should have some sample code, and I will try to write some, but I hoped that in the meantime someone here with more experience already has a hint for me, where to debug further or how to fix it.
As far as I know, Text::Table requires perl strings to properly format tables. But shouldn't my string be a perl string when decoded?
Many thanks in advance.