File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2523,16 +2523,23 @@ def openFile(filename, mode='r'):
25232523
25242524def decodeIntToUnicode (value ):
25252525 """
2526- Decodes inferenced integer value with usage of current page encoding
2526+ Decodes inferenced integer value to an unicode character
25272527 """
2528- try :
2529- # http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_ord
2530- if Backend .getIdentifiedDbms () in (DBMS .MYSQL ,) or conf .charset :
2531- return struct .pack ('B' if value < 256 else '<H' , value ).decode (kb .pageEncoding or UNICODE_ENCODING )
2532- else :
2533- return unichr (value )
2534- except :
2535- return INFERENCE_UNKNOWN_CHAR
2528+ retVal = value
2529+
2530+ if isinstance (value , int ):
2531+ try :
2532+ # http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_ord
2533+ if Backend .getIdentifiedDbms () in (DBMS .MYSQL ,):
2534+ retVal = getUnicode (struct .pack ('B' if value < 256 else '<H' , value ))
2535+ elif value > 255 :
2536+ retVal = unichr (value )
2537+ else :
2538+ retVal = getUnicode (chr (value ))
2539+ except :
2540+ retVal = INFERENCE_UNKNOWN_CHAR
2541+
2542+ return retVal
25362543
25372544def unhandledExceptionMessage ():
25382545 """
You can’t perform that action at this time.
0 commit comments