UTF8 XML-RPC requests/wrong encoding of UTF8 characters
Erik <[email protected]>
| Newsgroups | gmane.text.xml.rpc.specification |
|---|---|
| Message-ID | <[email protected]> |
Hello list,
I'm looking for some help with my utf8 problem. I'm trying to write some
RPC-Client with the 'Frontier::Client' library but I don't get it.
Here's the small sample code for demonstration. (NOTE: I know that
www.google.de is not offering some XML-RPC services under this address
but that's is not the problem. See below for more details.)
#!/usr/bin/perl
use strict;
use warnings;
use Frontier::Client;
use Data::Dumper;
use utf8;
use encoding 'utf8';
my $url = "http://www.google.de";
my $client = Frontier::Client->new( url => $url,
debug => 1,
encoding => 'utf-8',
use_objects => 1,
);
# these are 3 german umlauts (UTF8 3x times 0xc3 0xa4)
my @args = ('ÀÀÀ');
my @results = $client->call('umlaute', @args);
I've saved this script in UTF8 on disc and confirmed the UTF8 mode with
an hexdump of the script.
Then I start an hexdump on my console for my network device 'eth0'. I'm
using 'tcpdump -X -s 2048 -i eth0 host www.google.de' but the exact
syntax depends on your OS.
Here is a hexdump of the request (the response doesn't matter here):
0x0000: 4500 00d1 0528 4000 4006 79c7 0a00 10dc E....(@[email protected].....
0x0010: 42f9 5d63 9987 0050 b620 2dd7 f8a6 30a6 B.]c...P..-...0.
0x0020: 5018 16d0 bbfb 0000 3c3f 786d 6c20 7665 P.......<?xml.ve
0x0030: 7273 696f 6e3d 2231 2e30 2220 656e 636f rsion="1.0".enco
0x0040: 6469 6e67 3d22 7574 662d 3822 3f3e 0a3c ding="utf-8"?>.<
0x0050: 6d65 7468 6f64 4361 6c6c 3e0a 3c6d 6574 methodCall>.<met
0x0060: 686f 644e 616d 653e 756d 6c61 7574 653c hodName>umlaute<
0x0070: 2f6d 6574 686f 644e 616d 653e 0a3c 7061 /methodName>.<pa
0x0080: 7261 6d73 3e0a 3c70 6172 616d 3e3c 7661 rams>.<param><va
0x0090: 6c75 653e 3c73 7472 696e 673e e4e4 e43c lue><string>...<
0x00a0: 2f73 7472 696e 673e 3c2f 7661 6c75 653e /string></value>
0x00b0: 3c2f 7061 7261 6d3e 0a3c 2f70 6172 616d </param>.</param
0x00c0: 733e 0a3c 2f6d 6574 686f 6443 616c 6c3e s>.</methodCall>
0x00d0: 0a .
As you can see the 3 three umlauts are encoded as three octets (using
the 'TERMINOLOGY' of 'perldoc Encode'). Why is that? I've expected that
I can see 3x2 octets (0xc3 0xa4 0xc3 0xa4 0xc3 0xa4) in the hexdump of
my network card. The octed 0xe4 from the hexdump is the representation
of the german umlaut 'a' in ISO-8859-1. Why that?
If I change the content of @args to an asian character (0xe3 0x82 0x89)
I'm getting a error message '500 Wide character in syswrite' during the
request. Why that?
I've found only ASCII examples in 'Frontier-RPC-0.07b4/examples' without
any utf8 stuff so I'm stucked here too.
What's my problem?
% locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
% perl -v
This is perl, v5.8.8 built for i686-linux
--
So long... Fuzz
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/xml-rpc/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/