NAME HTTP::Response::Encoding - Adds encoding() to HTTP::Response VERSION Version 0.01 SYNOPSIS use LWP::UserAgent; use HTTP::Response::Encoding; my $ua = LWP::UserAgent->new(); my $res = $ua->get("http://www.example.com/"); warn $res->encoding; print $res->decoded_content; EXPORT Nothing. METHODS This module adds the following methods to HTTP::Response objects. "$res->encoding" Tells the content encoding in the canonical name in Encode. Returns undef if it can't. For most cases, you are more likely to successfully find encoding after GET than HEAD. HTTP::Response is smart enough to parse But you need the content to let HTTP::Response parse it. If you don't want to retrieve the whole content but interested in its encoding, try something like below; my $req = HTTP::Request->new(GET => $uri); $req->headers->header(Range => "bytes=0-4095"); # just 1st 4k my $res = $ua->request($req); warn $res->encoding; "$res->decoded_content" Returns "$res->content" but decoded to Perl utf8 string. Roughly equivalent to the code below. Encode::decode($res->encoding, $res->content) Note it croaks when $res->encoding is false. So you should check "$res->encoding" before using this method. # i.e. $content = $res->decoded_content if $res->encoding. Also note that the meta tag remains intact. INSTALLATION To install this module, run the following commands: perl Makefile.PL make make test make install AUTHOR Dan Kogai, "" BUGS Please report any bugs or feature requests to "bug-http-response-encoding at rt.cpan.org", or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. SUPPORT You can find documentation for this module with the perldoc command. perldoc HTTP::Response::Encoding You can also look for information at: * AnnoCPAN: Annotated CPAN documentation * CPAN Ratings * RT: CPAN's request tracker * Search CPAN ACKNOWLEDGEMENTS COPYRIGHT & LICENSE Copyright 2007 Dan Kogai, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.