I had the same problem and wrote a new module HTTP::Response::Charset that exactly does it, i.e: add charset() method to $response object. http://use.perl.org/~miyagawa/journal/31250
On 1/12/07, Bill Moseley <[EMAIL PROTECTED]> wrote:
On Mon, Jan 08, 2007 at 08:11:54PM +0100, Gisle Aas wrote: > >It would be handy to have a charset method. > > Noted. Also for the wish list: It would be nice if the uncompressing was separate from the decoding the charset. I'm spidering and then piping the output to another program. So, I need to get the uncompressed and decoded content into the spider for processing (and extracting links). That's where $response->decoded_content; comes in handy. But, I also need to print the content back out. The content needs to be re-encoded at this point. I have two choices for encoding the output: one is to re-encode into the original charset (hence $response->charset would be handy), or I could always output utf8, but then I'd need to replace the charset in any http-equiv meta tags to reflect the utf8 encoding. And if uncompressing was a separate method from decodings I could just print $response->uncoompressed_content; and print the content uncompressed, but still encoded in the original encoding. -- Bill Moseley [EMAIL PROTECTED]
-- Tatsuhiko Miyagawa