remove FORM FEED and ESC from sent data

This commit is contained in:
Dimitur Kirov 2006-02-22 13:09:33 +00:00
parent 9991a13dcc
commit acdb712838
1 changed files with 2 additions and 1 deletions

View File

@ -21,7 +21,8 @@ import xml.parsers.expat
def XMLescape(txt):
"""Returns provided string with symbols & < > " replaced by their respective XML entities."""
return txt.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace('"', "&quot;")
# replace also FORM FEED and ESC, because they are not valid XML chars
return txt.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace('"', "&quot;").replace(u'\x0C', "").replace(u'\x1B', "")
ENCODING='utf-8'
def ustr(what):