Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: XML::Simple and ISO-8859-1 encoding buggy?

by Anonymous Monk
on May 27, 2021 at 15:19 UTC ( [id://11133142]=note: print w/replies, xml ) Need Help??


in reply to XML::Simple and ISO-8859-1 encoding buggy?

Off-the-wall suggestion: what happens if, instead of hand-decoding $xml, you

my $xml = $LWP_Data->{feed}->decoded_content;

I do not use XML::Simple, but a quick read seems to say that decoding (if any) is done by the back end. Maybe the back end (whatever it is) assumes that if you hand it a string that string has already been decoded?

Of course, this only works if the HTTP::Response object contains the encoding. You can check using lwp-request -m HEAD https://some.url/file.xml.

Replies are listed 'Best First'.
Re^2: XML::Simple and ISO-8859-1 encoding buggy?
by ikegami (Patriarch) on May 27, 2021 at 22:05 UTC

    That would be the opposite of what you want. You want the undecoded content.

    Seeking work! You can reach me at ikegami@adaelis.com

        Transfer encodings (gzip, compress, etc) are already removed automatically. No need to use decoded_content for that.

        decoded_content does remove some content encodings. This means, for example, that it allows you to request a .gz file and get the .xml within. But the OP didn't say anything about requesting a non-XML file and wanting to get the XML from it.

        Finally, and most relevant, it also undoes character encodings, and that's bad. It can be told not to do this, but my comment was directed a code that didn't prevent this.

        Seeking work! You can reach me at ikegami@adaelis.com

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11133142]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-03-29 12:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found