removing xmlcharrefreplace error handler as it seems that it wasn't such a good idea at the end

This commit is contained in:
Miroslav Stampar 2011-05-15 21:43:38 +00:00
parent c3bb5a03e1
commit 90e84c9a6d
2 changed files with 3 additions and 3 deletions

View File

@ -1798,7 +1798,7 @@ def getUnicode(value, encoding=None, system=False):
if isinstance(value, unicode): if isinstance(value, unicode):
return value return value
elif isinstance(value, basestring): elif isinstance(value, basestring):
return unicode(value, encoding or UNICODE_ENCODING, errors="xmlcharrefreplace") return unicode(value, encoding or UNICODE_ENCODING, errors="replace")
else: else:
return unicode(value) # encoding ignored for non-basestring instances return unicode(value) # encoding ignored for non-basestring instances
else: else:

View File

@ -85,7 +85,7 @@ def urldecode(value, encoding=None):
result = urllib.unquote_plus(value) result = urllib.unquote_plus(value)
if isinstance(result, str): if isinstance(result, str):
result = unicode(result, encoding or UNICODE_ENCODING, errors="xmlcharrefreplace") result = unicode(result, encoding or UNICODE_ENCODING, errors="replace")
return result return result
@ -137,7 +137,7 @@ def unicodeencode(value, encoding=None):
try: try:
retVal = value.encode(encoding or UNICODE_ENCODING) retVal = value.encode(encoding or UNICODE_ENCODING)
except UnicodeEncodeError: except UnicodeEncodeError:
retVal = value.encode(UNICODE_ENCODING, "xmlcharrefreplace") retVal = value.encode(UNICODE_ENCODING, "replace")
return retVal return retVal
def utf8encode(value): def utf8encode(value):