Another fix related to the last commit

This commit is contained in:
Miroslav Stampar 2014-05-09 22:55:16 +02:00
parent 5eae002084
commit 8f0807d7f9

View File

@ -1994,7 +1994,10 @@ def getUnicode(value, encoding=None, system=False, noneToNull=False):
except UnicodeDecodeError, ex: except UnicodeDecodeError, ex:
return value[:ex.start] + "".join(INVALID_UNICODE_CHAR_FORMAT % ord(_) for _ in value[ex.start:ex.end]) + value[ex.end:] return value[:ex.start] + "".join(INVALID_UNICODE_CHAR_FORMAT % ord(_) for _ in value[ex.start:ex.end]) + value[ex.end:]
else: else:
return unicode(value, errors="ignore") # encoding ignored for non-basestring instances try:
return unicode(value)
except UnicodeDecodeError:
return unicode(str(value), errors="ignore") # encoding ignored for non-basestring instances
else: else:
try: try:
return getUnicode(value, sys.getfilesystemencoding() or sys.stdin.encoding) return getUnicode(value, sys.getfilesystemencoding() or sys.stdin.encoding)