You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@ws.apache.org by "Shirai,Kaoru" <sh...@korinkan.co.jp> on 2004/09/02 08:39:35 UTC

Passing non-ASCII String value

I have downloaded Apache XML-RPC 1.2-b1, and tried to invoke a remote
service with the following code:

XmlRpc.setEncoding("UTF8");
XmlRpcClient client = new XmlRpcClient(url);
Object[] args = new Object[] { "__STRING__" };
client.execute("remote.method", new Vector(Arrays.asList(args)));

If __STRING__ contains non-ASCII(c < 0x20 || c > 0xff)-character, it
fails with a  error "Invalid character data corresponding to XML
entity" at XMLWriter.chardata(String).

At XMLWriter.chardata(String) of CVS revision 1.2, it seems to just
pass the character to OutputStreamWriter.write(). Is that behaves
wrong? Why has it changed in 1.3 and 1.4?

Or is there another way to pass non-ASCII string for <string> value?
-- 
Shirai,Kaoru <sh...@korinkan.co.jp>
Korinkan Ltd. - http://www.korinkan.co.jp/

Re: Passing non-ASCII String value

Posted by "Shirai,Kaoru" <sh...@korinkan.co.jp>.
Thank you for your reply, John.

> Are you sure that it objects to characters with values > 0XFF?
> 
> It certainly should refuse to send characters with values less than 
> 0X20 unless they are /n, /r or /t. The XML spec spec does not allow 
> these values in a well formed XML document.

Sorry, that's right about values < 0x20. There is no problem that I
cannot send those characters. But about characters with values > 0xFF,
XML 1.0 allows it except for some special characters:

Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] |
         [#x10000-#x10FFFF]
http://www.w3.org/TR/REC-xml/#charsets

I think those should be allowed. The string I want to send only
contains Unicode characters defined in above.
-- 
Shirai,Kaoru <sh...@korinkan.co.jp>
Korinkan Ltd. - http://www.korinkan.co.jp/

Re: Passing non-ASCII String value

Posted by John Wilson <tu...@wilson.co.uk>.
On 2 Sep 2004, at 07:39, Shirai,Kaoru wrote:

> I have downloaded Apache XML-RPC 1.2-b1, and tried to invoke a remote
> service with the following code:
>
> XmlRpc.setEncoding("UTF8");
> XmlRpcClient client = new XmlRpcClient(url);
> Object[] args = new Object[] { "__STRING__" };
> client.execute("remote.method", new Vector(Arrays.asList(args)));
>
> If __STRING__ contains non-ASCII(c < 0x20 || c > 0xff)-character, it
> fails with a  error "Invalid character data corresponding to XML
> entity" at XMLWriter.chardata(String).
>
> At XMLWriter.chardata(String) of CVS revision 1.2, it seems to just
> pass the character to OutputStreamWriter.write(). Is that behaves
> wrong? Why has it changed in 1.3 and 1.4?
>
> Or is there another way to pass non-ASCII string for <string> value?
>

Are you sure that it objects to characters with values > 0XFF?

It certainly should refuse to send characters with values less than 
0X20 unless they are /n, /r or /t. The XML spec spec does not allow 
these values in a well formed XML document.

If you need to send arbitrary binary data you will need to use Base64.


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