Forum Moderators: coopster & phranque

Message Too Old, No Replies

How to set Charset in LWP::UserAgent?

         

flashfan

5:24 pm on Feb 26, 2004 (gmt 0)

10+ Year Member



I am using LWP::UserAgent and HTTP::Request to post data; Now I need change the charset to UTF-8. Is there a way to do that?

Thanks in advance for any info.

SeanW

9:53 pm on Feb 26, 2004 (gmt 0)

10+ Year Member



When you're doing your $ua->post you can pass headers... I don't have access to my box right now but it's something like

my $resp = $ua->post($url, $fieldref, $headerref);

where $headerref can be something like

$headderref = { Accept-Charset => "UTF-8" }; # or whatever the header is really called

It's the same idea as changing the referrer.

Sean