When fetching a web page containing UTF8-encoded content from a server that doesn't say that it's sending out UTF8 via a response header, I'm getting this warning with LWP::Useragent on a simple get():
Parsing of undecoded UTF-8 will give garbage 
when decoding entities at .../LWP/Protocol.pm line xx.
The cause seems to be HTML::Parser (or better HTML::HeadParser) which assumes non-UTF8, but sees something that looks like UTF8.

It's a warning, so I guess I could just suppress it, but I wanted to know if you guys had seen this before and have figured out an elegant way to deal with it.

As explained here, parse_head() is necessary to deal with some oddball webservers, otherwise I could turn it off in LWP::UserAgent's constructor.


In reply to Parsing of undecoded UTF-8 will give garbage by saintmike

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.