Commit e0be5c21 authored by sylvain.thenault@logilab.fr's avatar sylvain.thenault@logilab.fr
Browse files

new xml_escape function, doing html_escape + control characters escaping

parent 4897d2f956ef
......@@ -86,6 +86,10 @@ def html_escape(data):
return (data.replace('&','&amp;').replace('<','&lt;').replace('>','&gt;')
.replace('"','&quot;').replace("'",'&#39;'))
def xml_escape(data):
# XXX remove more control characters
return html_escape(data).replace('\f', '\n').replace('\b', '')
def html_unescape(data):
"""unescapes XML/HTML entities"""
for entityname, codepoint in htmlentitydefs.name2codepoint.iteritems():
......
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