You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-auto@ws.apache.org by "Yann Cordier (JIRA)" <xm...@ws.apache.org> on 2008/01/24 11:33:35 UTC

[jira] Commented: (XMLRPC-152) XmlRpcClientConfigImpl.setEncoding() does not affect response parser's encoding

    [ https://issues.apache.org/jira/browse/XMLRPC-152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562006#action_12562006 ] 

Yann Cordier commented on XMLRPC-152:
-------------------------------------

I successfully corrected the problem by modifying org.apache.xmlrpc.client.XmlRpcStreamTransport as follows :

In the method "protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException", I added the following line, after the InputSource instanciation :

		isource.setEncoding(pConfig.getEncoding());

Doing this will propagate the chosen encoding to the response parser, and a ISO-8859-1 encoded response containing special characters will be correctly processed.

There might be some other changes to do as I am not a Apache XMLRPC specialist.




> XmlRpcClientConfigImpl.setEncoding() does not affect response parser's encoding
> -------------------------------------------------------------------------------
>
>                 Key: XMLRPC-152
>                 URL: https://issues.apache.org/jira/browse/XMLRPC-152
>             Project: XML-RPC
>          Issue Type: Bug
>          Components: Source
>    Affects Versions: 3.0, 3.1, 3.1.1
>         Environment: Windows Apache XMLRPC client - Linux Apache XMLRPC server - using enconding ISO-8859-1 with euro symbol in String data
>            Reporter: Yann Cordier
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> When sending a XMLRPC request thru a XmlRpcClient object, calls to :
>   XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
>   config.setEncoding("ISO-8859-1");
>   XmlRpcClient client = new XmlRpcClient();
>   client.setConfig(config);
> will only set the request's encoding but not the response.
> Therefore, response's parser will use the default UTF-8 encoding which only compatible with the US-ASCII character set (first 128 chars).
> If the response is encoded using ISO-8859-1 (or other US-ASCII extensions) and contains special characters like the euro symbol (€), the following exception is thrown by the SAX parser (complete stack trace) and the response cannot be processed :
> com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 3-byte UTF-8 sequence.
> 	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:674)
> 	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:398)
> 	at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742)
> 	at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar(XMLEntityScanner.java:1416)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2777)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645)
> 	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
> 	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
> 	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
> 	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
> 	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
> 	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
> 	at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:176)
> 	at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:145)
> 	at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94)
> 	at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:39)
> 	at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
> 	at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
> 	at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:157)
> 	at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:146)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.