[Zope-Checkins] CVS: Zope2 - PropertySheets.py:1.74.4.1
andreas@serenade.digicool.com
andreas@serenade.digicool.com
Fri, 29 Jun 2001 11:53:40 -0400
Update of /cvs-repository/Zope2/lib/python/OFS
In directory serenade:/tmp/cvs-serv31015/lib/python/OFS
Modified Files:
Tag: Zope-2_4-branch
PropertySheets.py
Log Message:
--- Updated File PropertySheets.py in package Zope2 --
--- PropertySheets.py 2001/06/06 14:47:47 1.74
+++ PropertySheets.py 2001/06/29 15:53:39 1.74.4.1
@@ -375,7 +375,7 @@
else:
# Quote non-xml items here?
attrs=''
- prop=' <n:%s%s><![CDATA[%s]]></n:%s>' % (name, attrs, value, name)
+ prop=' <n:%s%s><![CDATA[%s]]></n:%s>' % (name, attrs, xml_escape(value), name)
result.append(prop)
if not result: return ''
result=join(result, '\n')
@@ -804,3 +804,16 @@
if callable(attr):
return attr()
return attr
+
+from DocumentTemplate.DT_Util import html_quote
+
+
+def xml_escape(v):
+ """ convert any content from ISO-8859-1 to UTF-8
+ The main use is to escape non-US object property values
+ (e.g. containing accented characters). Although the property
+ values are put inside a CDATA section MSIE 6 is unable to handle
+ this correctly).
+ """
+
+ return unicode(str(v),"latin-1").encode("utf-8")