"Mitchell, Louise M" <[EMAIL PROTECTED]> writes:
> I need to grab the encoding of pages I'm retrieving with
> LWP::UserAgent... my perusal of the documentation indicated I could use
> the LWP::MediaTypes to get the encoding... it says to pass a URI object
> reference and return in array context to get it...I'm not having any
> luck...
The encoding returned by guess_media_type() is what goes in the
Content-Encoding header. It is stuff like "compress" or "gzip".
> Below is my code... and below that a snippet from the HTML returned... I
> can see that the encoding is iso-8859-1, as indicated in the first meta
> tag... but my code is not retrieving it...
You want the charset attribute. It is found in the Content-Type
header. I have been thinking about adding a 'charset' method to
HTTP::Message, but that has not happened yet. The best way currently
is to use some regular expressions on the
$response->header("Content-Type") or use the split_header_words()
function from HTTP::Headers::Util to parse the content type properly.
Regards,
Gisle