From 345e2288e1529daf5668c1e9ed7dfc782ab9d118 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 20 Jan 2011 13:54:18 +0000 Subject: [PATCH] important fix regarding encoding stuff --- lib/core/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index df02cbc39..4a106f1b1 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1417,7 +1417,7 @@ def getUnicode(value, encoding=None): if isinstance(value, unicode): return value elif isinstance(value, basestring): - return unicode(value, encoding or conf.dataEncoding) + return unicode(value, encoding or conf.dataEncoding, errors="replace") else: return unicode(value) # encoding ignored for non-basestring instances @@ -2218,6 +2218,6 @@ def decodeIntToUnicode(value): Decodes inferenced integer value with usage of current page encoding """ try: - return struct.pack('>H', value).decode(kb.pageEncoding) + return struct.pack('B' if value<256 else '>H', value).decode(kb.pageEncoding) except: return INFERENCE_UNKNOWN_CHAR