Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > LWP::UserAgent and 8bit characters

Reply
Thread Tools

LWP::UserAgent and 8bit characters

 
 
T Conti
Guest
Posts: n/a
 
      09-07-2004
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
 
Reply With Quote
 
 
 
 
T Conti
Guest
Posts: n/a
 
      09-08-2004
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.

http://www.velocityreviews.com/forums/(E-Mail Removed) (T Conti) wrote in message news:<(E-Mail Removed). com>...
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
8bit * 8bit pipelined multiplier humble VHDL 0 10-28-2006 06:16 PM
8bit counter to 7seg jo.spreutels@gmail.com VHDL 5 06-12-2005 08:52 AM
Convert a monochrome (1bit) image into a grayscale (8bit) one =?ISO-8859-1?Q?Christian_H=F6ntsch-Rode?= Java 6 02-03-2005 11:22 AM
8bit to 7bit numbers marko Perl 0 08-23-2003 10:50 AM
char 8bit wide or 7bit wide in c++? Web Developer C++ 2 07-31-2003 08:09 AM



Advertisments