Minor just in case update for an Issue #195 (safer behavior on forced charsets)

This commit is contained in:
Miroslav Stampar 2012-09-25 15:09:07 +02:00
parent efe4c13ed1
commit 6bc5f44b20

View File

@ -1839,10 +1839,7 @@ def getUnicode(value, encoding=None, system=False, noneToNull=False):
if isinstance(value, unicode): if isinstance(value, unicode):
return value return value
elif isinstance(value, basestring): elif isinstance(value, basestring):
try: return unicode(value, encoding or kb.pageEncoding or UNICODE_ENCODING, "replace")
return unicode(value, encoding or kb.pageEncoding)
except:
return unicode(value, UNICODE_ENCODING, "replace")
else: else:
return unicode(value) # encoding ignored for non-basestring instances return unicode(value) # encoding ignored for non-basestring instances
else: else: