Commit 50c03f7c authored by Andreas Jung's avatar Andreas Jung

updated xml_escape() from 2.4 branch

parent 2690f425
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Property sheets""" """Property sheets"""
__version__='$Revision: 1.75 $'[11:-2] __version__='$Revision: 1.76 $'[11:-2]
import time, string, App.Management, Globals import time, string, App.Management, Globals
from webdav.WriteLockInterface import WriteLockInterface from webdav.WriteLockInterface import WriteLockInterface
...@@ -814,8 +814,10 @@ def xml_escape(v): ...@@ -814,8 +814,10 @@ def xml_escape(v):
(e.g. containing accented characters). Also we convert "<" and ">" (e.g. containing accented characters). Also we convert "<" and ">"
to entities to keep the properties XML compliant. to entities to keep the properties XML compliant.
""" """
v = str(v)
v = str(v).replace('<','&lt;') if v.count('<') != v.count('>'):
v = v.replace('<','&lt;')
v = v.replace('>','&gt;') v = v.replace('>','&gt;')
return unicode(v,"latin-1").encode("utf-8") return unicode(v,"latin-1").encode("utf-8")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment