Commit e0be5c21 authored by's avatar
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;')
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():
Supports Markdown
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