From c3bb5a03e192727fd6104c2a71d6648dbb07760c Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sat, 14 May 2011 20:09:37 +0000 Subject: [PATCH] minor improvement --- lib/core/common.py | 4 ++-- lib/core/convert.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index 6cf953a81..8d51f8ee8 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -653,7 +653,7 @@ def dataToStdout(data, forceOutput=False): warnMsg = "cannot properly display Unicode characters " warnMsg += "inside Windows OS command prompt " warnMsg += "(http://bugs.python.org/issue1602). All " - warnMsg += "similar occurances will result in " + warnMsg += "unhandled occurances will result in " warnMsg += "replacement with '?' character. Please, find " warnMsg += "proper character representation inside " warnMsg += "coresponding output files. " @@ -1798,7 +1798,7 @@ def getUnicode(value, encoding=None, system=False): if isinstance(value, unicode): return value elif isinstance(value, basestring): - return unicode(value, encoding or UNICODE_ENCODING, errors="replace") + return unicode(value, encoding or UNICODE_ENCODING, errors="xmlcharrefreplace") else: return unicode(value) # encoding ignored for non-basestring instances else: diff --git a/lib/core/convert.py b/lib/core/convert.py index 6746a1fa6..1422d330b 100644 --- a/lib/core/convert.py +++ b/lib/core/convert.py @@ -85,7 +85,7 @@ def urldecode(value, encoding=None): result = urllib.unquote_plus(value) if isinstance(result, str): - result = unicode(result, encoding or UNICODE_ENCODING, errors="replace") + result = unicode(result, encoding or UNICODE_ENCODING, errors="xmlcharrefreplace") return result @@ -137,7 +137,7 @@ def unicodeencode(value, encoding=None): try: retVal = value.encode(encoding or UNICODE_ENCODING) except UnicodeEncodeError: - retVal = value.encode(UNICODE_ENCODING, "replace") + retVal = value.encode(UNICODE_ENCODING, "xmlcharrefreplace") return retVal def utf8encode(value):