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

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Thu Oct 7 04:43:16 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 #3 by ajung on Oct 7, 2004 4:43 am

Nonsense.
The default encoding for XML documents is UTF8. This
has absolutely nothing to do with any information within
the HTTP header. If the 'encoding' attribute within the XML 
preamble is not present then the default encoding UTF-8 applies...nothing else.
________________________________________
= 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