[Twisted-web] XMLRPC response encoding

Jean-Paul Calderone exarkun at divmod.com
Mon Oct 22 07:55:49 EDT 2007


On Mon, 22 Oct 2007 13:31:31 +0200, Daniel de la Cuesta <daniel.cuesta at iavante.es> wrote:
><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
><html>
><head>
>  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
>  <title></title>
></head>
><body bgcolor="#ffffff" text="#000000">
>Hi,<br>
><br>
>We are working on a middleware with Twisted that connects to a POP3
>server and provides an XMLRPC interface (using twisted.web)) to
>interacts with third party clients.<br>
><br>
>The twisted middleware has to deal with non ASCII (UTF-8 or Latin-1)
>encodings in the subject and the body of the mail messages. I have seen
>that Twisted XMLRPC server doesn't specify the encoding of the XMLRPC
>response, for example:<br>
><br>
><pre>&lt;?xml version='1.0'?&gt;</pre>
><pre>&lt;methodCall&gt;</pre>
><pre>&lt;methodName&gt;connect&lt;/methodName&gt;</pre>
><pre>&lt;params&gt;</pre>
><pre>...</pre>
><pre>&lt;/params&gt;</pre>
><pre>&lt;/methodCall&gt;</pre>
><br>
>This issue produces an error when "expat" parses the response in the
>xmlrpc client:<br>
><br>
><pre>xml.parsers.expat.ExpatError: not well-formed (invalid token)
>
></pre>
>There is an open ticket with a patch to deal with "Latin-1" encodings
>at the xmlrpc server:<br>
><br>
><a href="http://twistedmatrix.com/trac/ticket/1909">http://twistedmatrix.com/trac/ticket/1909</a><br>
><br>
>But it is not closed and it has been opened one year ago. <br>
><br>
>How can I solve the encoding problem in the XMLRPC server response? <br>

Help resolve #1909.  The patch attached to the ticket is at least missing
unit tests for the new functionality it provides.  If you can provide this,
then we might be able to add the feature and resolve the ticket

Jean-Paul



More information about the Twisted-web mailing list