[ZCM] [ZC] 1476/ 2 Comment "xmlrpc server returning not well formed xml in some cases"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Fri Aug 27 18:32:33 EDT 2004


Issue #1476 Update (Comment) "xmlrpc server returning not well formed xml in some cases"
 Status Pending, Zope/bug low
To followup, visit:
  http://collector.zope.org/Zope/1476

==============================================================
= Comment - Entry #2 by godefroy on Aug 27, 2004 6:32 pm


Uploaded:  "xmlrpc-fault.patch"
 - http://collector.zope.org/Zope/1476/xmlrpc-fault.patch/view
Example patch.

In case that fault description is not valid utf-8 string it replaces all chars that are > 127 to question marks.

This can be done with re or doing "value = repr(value)" - I don't know which is faster. Patched code just iterates over the string chars.

Patch against current svn revision: 27314.

HTH.
________________________________________
= Request - Entry #1 by godefroy on Aug 20, 2004 9:39 am

xmlrpc response contains exception information, which is included as is.

if exception has "strange" characters (not utf-8 characters) resulting xml is not well formed xml.

xmlrpc server implementation should always return valid xml. if there's an error on server side, an Fault object should be returned. suppose there is an error (offending exception), there's an another error - bad encoding in exceptions's description (this one is light), response should be a valid xml anyway.

proposed solution: test strings against .decode('utf-8') and include repr() it this throws exception unicode exception. this (i guess) should be faster than trying to parse xml after is is constructed.

thanks.
==============================================================



More information about the Zope-Collector-Monitor mailing list