ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Wilson <...@wilson.co.uk>
Subject Re: setEncoding broken? (Was re: accented characters in XMLRPC arguments)
Date Thu, 11 Dec 2003 19:40:17 GMT

On 11 Dec 2003, at 19:12, Dylan McNamee wrote:

> At the risk of chatting with myself on a public mailing list, I hereby 
> revise my last email to say "it would seem that 
> XmlRpc.setEncoding("UTF-8") is broken in 1.2-b1".
>
> I've tried calling this, as well as "UTF8" (since that's what Java 
> seems to like to call it), and regardless, it doesn't seem to affect 
> how the parser is configured, nor does whether I call setEncoding 
> before or after creating my xmlrpcClient. Regardless of any of these 
> permutations, I always get this exception:
>
> java.io.IOException: Invalid character data corresponding to XML 
> entity &#8730;
> 	at 
> org.apache.xmlrpc.XmlRpcClient$Worker.execute(XmlRpcClient.java:444)
> 	at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:163)
>

The problem is not caused by the encoding. It's a restriction imposed 
by the XML-RPC implementation which stops Unicode characters with 
values . 0XFF being written.

At one point in time the XML-RPC spec limited the Unicode characters in 
strings to be ASCII. The Apache XML-RPC actually limited them to be ISO 
8859/1. Some time ago that restriction was lifted but the XML-RPC code 
has not been updated to reflect this.

You are trying to send a character with a value of 8730 (the 
mathematical operator square root). Currently Apache XML-RPC won't 
support that.

The encoding is irrelevant. Any encoding is capable of expressing all 
the Unicode characters.

If you want to patch your code to fix this look in XMLWriter.java and 
find where it throws the exception.

Change

if (c < 0x20 || c > 0xff)

to

if (c < 0x20)

This should fix your problem no matter what encoding is used.



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


Mime
View raw message