http://www.perlmonks.org?node_id=683836


in reply to libwww-perl, POE and Unicode

eval { $content = $response->decoded_content }; if ($content) { $response->content($content); }

That's bad. HTTP::Message has separate methods for this for a very good reason: An HTTP message can only ever be a sequence of octets. Together with the charset attribute of the Content-Type header, you can decode this sequence of octet, and get a Unicode string from it; the decoded_content method automates this common use. It looks like PoCoCli::HTTP is trying to be helpful and do this so that its users don't have to, but this is a bad idea because:

I guess the LWP author got tired of (hearing about) weird bugs caused by sending this kind of corrupt HTTP messages and decided to end this madness. I applaud this decision. Now PoCoCli::HTTP's author has to fix their module. Which, yes, will probably break lots of existing code using PoCoCli::HTTP that depended on this helpfulness. And again we see that innocent users are hurt by someone's ignorance of (or lack of appreciation for) the binary versus text distinction.

Remove these two lines, and use decoded_content instead of content if you need the decoded content.

Juerd # { site => 'juerd.nl', do_not_use => 'spamtrap', perl6_server => 'feather' }