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 "Jochen Wiedmann (JIRA)" <xm...@ws.apache.org> on 2006/05/09 22:46:08 UTC

[jira] Geschlossen: (XMLRPC-30) XML-RPC client doesn't handle the enconding specified by the XmlRpc.setEncoding() method

     [ http://issues.apache.org/jira/browse/XMLRPC-30?page=all ]
     
Jochen Wiedmann closed XMLRPC-30:
---------------------------------

    Resolution: Fixed
     Assign To:     (was: rpc-dev mailing list)

It is quite unlikely that this problem does stilly apply to version 2, not to mention version 3. If it does, please reopen the issue.


> XML-RPC client doesn't handle the enconding specified by the XmlRpc.setEncoding() method
> ----------------------------------------------------------------------------------------
>
>          Key: XMLRPC-30
>          URL: http://issues.apache.org/jira/browse/XMLRPC-30
>      Project: XML-RPC
>         Type: Bug

>   Components: Source
>     Versions: unspecified
>  Environment: Operating System: All
> Platform: All
>     Reporter: Klopp Gérald

>
> I'm using the Apache XML-RPC 1.1 library but it seems that the 
> XmlRpcClient doesn't handle the encoding specified by the XmlRpc.setEncoding() 
> method
> I have written a XmlRpcServer using UTF-8 encoding.
> A call to XmlRpc.setEncoding("UTF8") enables to set it.
> The server works perfectly and returns UTF-8
> On my client side, I do the same : I set the encoding using the 
> XmlRpc.setEncoding() method. But it doesn't work, I can't read UTF-8 from my 
> server.
> I've watched the source code.
> The stream opened in the XmlRpc.parse(InputStream is) method doesn't 
> care about the setted encoding.
> So, I've modified this piece of code and, now, it works properly.
> This is the code I've modified :
> /**
> * Parse the input stream. For each root level object, method
> * Modified on 13/01/2003 to handle encoding specified by the 
> XmlRpc.setEncoding() method
> * <code>objectParsed</code> is called.
> */
> synchronized void parse (InputStream is)
> throws Exception
> {
> // reset values (XmlRpc objects are reusable)
> errorLevel = NONE;
> errorMsg = null;
> values = new Stack ();
> if (cdata == null)
> {
> cdata = new StringBuffer (128);
> }
> else
> {
> cdata.setLength (0);
> }
> readCdata = false;
> currentValue = null;
> long now = System.currentTimeMillis ();
> // Initializes parser
> ...
> Parser parser = null;
> try
> {
> parser = (Parser) parserClass.newInstance ();
> }
> catch (NoSuchMethodError nsm)
> {
> // This is thrown if no constructor exists for the parser 
> class
> // and is transformed into a regular exception.
> throw new Exception ("Can't create Parser: " + 
> parserClass);
> }
> parser.setDocumentHandler (this);
> parser.setErrorHandler (this);
> if (debug)
> System.err.println("Beginning parsing XML input stream");
> // BEFORE : ORIGINAL CODE
> // parser.parse (new InputSource (is));
> // AFTER : Modified by Klopp Gérald to take in charge 
> encoding specified
> // by the XmlRpc.setEnconding() method
> parser.parse( new InputSource( new InputStreamReader
> (is,getEncoding()) ) );
> if (debug)
> System.err.println ("Spent "+
> (System.currentTimeMillis () - now) + " millis 
> parsing");
> }
> Can you tell me more about this problem? Is this a bug?
> Thank you,
> Gérald Klopp

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira