From a212f0c240516175a43fe8e4b7d13f8325f0f5a0 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 16 Nov 2015 12:56:15 +0100 Subject: [PATCH] Another patch for #1539 --- lib/core/common.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index 0255cdc14..a15d7b768 100755 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -2943,16 +2943,17 @@ def decodeIntToUnicode(value): if isinstance(value, int): try: if value > 255: - if Backend.isDbms(DBMS.MSSQL): - encoding = "UTF-16-BE" - else: - encoding = conf.charset - _ = "%x" % value if len(_) % 2 == 1: _ = "0%s" % _ + raw = hexdecode(_) - retVal = getUnicode(hexdecode(_), encoding) + if Backend.isDbms(DBMS.MSSQL): + retVal = getUnicode(raw, "UTF-16-BE") + elif Backend.isDbms(DBMS.PGSQL): + retVal = unichr(value) + else: + retVal = getUnicode(raw, conf.charset) else: retVal = getUnicode(chr(value)) except: