[ZCM] [ZC] 1015/ 2 Comment "No encoding set for XML-RPC responses"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Thu Oct 7 04:28:59 EDT 2004


Issue #1015 Update (Comment) "No encoding set for XML-RPC responses"
 Status Pending, Zope/bug+solution medium
To followup, visit:
  http://zope.org/Collectors/Zope/1015

==============================================================
= Comment - Entry #2 by snej on Oct 7, 2004 4:28 am

XMLRPC requests are sent as "text/xml", which means the XML document is us-ascii, unless stated otherwise in the Content-Type HTTP-Header (see RFC3023 for details).
The XML declaration in the document does not declare the encoding. Maybe it's easier to encode the XML stream in us-ascii than to figure out the correct encoding?
________________________________________
= Request - Entry #1 by Anonymous User on Aug 7, 2003 6:15 pm

The XML returned by Zope as a response to an XML-RPC request contains no "encoding=" attribute to the <?xml?> header ...

This means that when there is high-bit latin 1 characters, such as accents, clients die (Including when using xmlrpclib as a client).

The problem is in lib/python/ZPublisher/xmlrpc.py, lines 110 and popssibly 101 also.

The calls to xmlrpclib.dumps() do not include the "encoding=" parameter.

Also because this is a function and not a method of a class, I can't seem to be able to easily monkey patch it :(

The simple solution would be to hardcode the most common charset in there ( i.e. encoding='iso-8859-1' ).

A better way would be to use the information provided by the locale module. Something like:

encoding=locale.getlocale()[1]

Would do ...

Admitedly however I'm not familiar with internal Zope internationalization, so there might be a better way through some Zope provided function ? (Though I don't see any first hand).
==============================================================



More information about the Zope-Collector-Monitor mailing list