LWP::UserAgent and 8bit characters

T

T Conti

Hello:

I am using LWP::UserAgent to make a vanilla request to a web service.
The return value is an XML file that may contain utf-8 characters.
However when I debug my module I see that the return test is getting
mangled. I can call the web service from IE and everything works
fine. Here is the code I am using to make the HTTP call:

my $ua = new LWP::UserAgent;
my $request = new HTTP::Request('GET', $queryURL);
my $response = $ua->request($request);
my $string = $response->content;

The resulting string slams umlates among other things. Here is a
sample of the garbled return data:

<Location>DE-Baden W├╝rttemberg-76137 Karlsruhe</Location>

The proper return data should be:
<Location>DE-Baden Württemberg-Obersontheim</Location>

The return XML is utf-8 encoded. The headers of the response object
seem to reflect this:

$VAR1 = bless( {
'client-response-num' => '1',
'x-aspnet-version' => '1.1.4322',
'content-type' => 'text/xml; charset=utf-8',
'connection' => 'close',
'date' => 'Tue, 07 Sep 2004 20:54:00 GMT',
'server' => 'Microsoft-IIS/5.0',
'client-date' => 'Tue, 07 Sep 2004 20:54:00 GMT',
'content-length' => '18835',
'cache-control' => 'private',
'x-powered-by' => 'ASP.NET'
}, 'HTTP::Headers' );


Any thoughts on how to handle this?

Thanks,
T
 
T

T Conti

I have been digging further and I found that the result from
LWP::UserAgent is not the issue. The issue is further along the
process after the return XML is parsed. It looks like the encoding
gets all screwed up. I also found that I can write umlates to an html
file, but the get slammed when they are rendered.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top