You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by Paul Guyot <pg...@kallisys.net> on 2003/05/25 03:16:42 UTC

Default XML driver and encoding problem

Hello all,

I had an encoding problem with the XmlRpc library from a recent check 
of the CVS (basically when I submitted my patch, ten days ago, nobody 
commented on this?).

I send a message from one instance to another of my application and 
the message's parameter is a Hashtable with strings in it. The user 
can actually type one of these strings for one of the messages. When 
I type a string with accents, the string is not displayed properly on 
the client side (sounds like a chat application, heh). After using 
ethereal, I realized the string was sent properly.

If I don't make any change, the string is sent in ISO-8859-1 and 
displayed here like an ISO-8859-1 string that wouldn't be translated 
in MacRoman (? -- I use Apple's 1.4.1 JVM).

If I tell XmlRpc to do UTF-8, I get an UTF-8 string that wouldn't be 
translated to MacRoman (with square roots for the first characters of 
a àéç sequence).

I've told XmlRpc to use Xerces and everything is fine.

For the moment, I'll just deploy with Xerces. But is there any way to 
tell XmlRpc to use Java's 1.4.x JVM built-in encoder? (I realize it's 
not the case of XmlRpc, but my application requires 1.4.1 anyway).

Paul
-- 
NPDS: http://newton.kallisys.net:8080/
Apache: http://www.kallisys.com/

Re: Default XML driver and encoding problem

Posted by John Wilson <tu...@wilson.co.uk>.
----- Original Message ----- 
From: "Paul Guyot" <pg...@kallisys.net>
To: <xm...@ws.apache.org>
Sent: Sunday, May 25, 2003 2:16 AM
Subject: Default XML driver and encoding problem


> Hello all,
>
> I had an encoding problem with the XmlRpc library from a recent check
> of the CVS (basically when I submitted my patch, ten days ago, nobody
> commented on this?).
>
> I send a message from one instance to another of my application and
> the message's parameter is a Hashtable with strings in it. The user
> can actually type one of these strings for one of the messages. When
> I type a string with accents, the string is not displayed properly on
> the client side (sounds like a chat application, heh). After using
> ethereal, I realized the string was sent properly.
>
> If I don't make any change, the string is sent in ISO-8859-1 and
> displayed here like an ISO-8859-1 string that wouldn't be translated
> in MacRoman (? -- I use Apple's 1.4.1 JVM).
>
> If I tell XmlRpc to do UTF-8, I get an UTF-8 string that wouldn't be
> translated to MacRoman (with square roots for the first characters of
> a àéç sequence).
>
> I've told XmlRpc to use Xerces and everything is fine.

The problem is cause by the fact that MinML ignores the encoding part of the
XML declaration in the document. Instead it uses the default encoding of the
system it's running on. In your case that's probably MacRoman. What should
happen (and what does happen if you use Xerces) is that the parser
translates the characters in the XML document from ISO 8859/1 to Unicode and
passes a Unicode string to your application. What MinML is doing is to use
the MacRoman to Unicode translation which results in characters being
mistranslated.

I'm producing a version of MinML which takes notice of the encoding part of
the declaration RSN.

John Wilson
The Wilson Partnership
http://www.wilson.co.uk