[ZCM] [ZC] 1561/ 2 Comment "PropertySheets xml_escape method with hardcoded encoding"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Sun Oct 31 19:03:26 EST 2004


Issue #1561 Update (Comment) "PropertySheets xml_escape method with hardcoded encoding"
 Status Pending, Zope/bug+solution medium
To followup, visit:
  http://zope.org/Collectors/Zope/1561

==============================================================
= Comment - Entry #2 by longsleep on Oct 31, 2004 7:03 pm

well .. i did some further investigation and the webdav module would need further changes to really support unicode type strings. 

Adding a .encode('UTF-8') to the string returned by PropertySheets.dav__allprop (when its unicode type) supports both unicode and non unicode type properties.
________________________________________
= Request - Entry #1 by longsleep on Oct 31, 2004 6:43 pm

While testing webdav i found the PropertySheet's xml_escape method which is called on dav's PROPGET to retrieve the properties (see OFS/PropertySheet.py right at the end) . This method has no notion at all regarding encoding. It has hardcoded unicode(v,"latin-1").encode("utf-8") and does a str() conversion without even checking if the property might be unicode already. 

I wonder how zope does in general handle unicode properties / properties with strings containing unicode? Both things wont work properly with this xml_escape method.

I suggest checking if "v" is already unicode type and then just quote entities. Then in addition with the new webdav.xmltools package the properties are fully unicode type. If "v" should be not unicode type its encoding has to be guessed from the ZMI encoding setting.

==============================================================



More information about the Zope-Collector-Monitor mailing list