FirebirdSQL / fdb

Firebird Driver for Python
https://www.firebirdsql.org/en/devel-python-driver/
Other
60 stars 26 forks source link

exception_from_status function gives an UnicodeDecodeError [PYFB72] #88

Closed firebird-automations closed 6 years ago

firebird-automations commented 6 years ago

Submitted by: Cagatay Tengiz (ctengiz)

This happens only when :

-- database connection set is not utf-8 (ie : win1254) -- exception is raised with a database exception which includes special charset characters ( ie : CREATE EXCEPTION ACCASH_NOTACTIVE 'Kasa kullanım dışı. Kod:'; --> and when raising this exception we get unicodedecode error)

in http://fbcore.py line 562. there is also a todo remark below this line.

best regards

firebird-automations commented 6 years ago

Commented by: @pcisar

This is hard one without ideal solution. I changed the code to use locale.getpreferredencoding() instead utf-8. This solution has next characteristics: - solves problem with national OS versions that return OS-related error messages with national characters - solves problem with national characters in error messages returned by Firebird if they match the preferred OS encoding. In most cases they match, but in cases they don't developers can go around this issue with proper OS locale settings.

firebird-automations commented 6 years ago
Modified by: @pcisar status: Open \[ 1 \] =\> Resolved \[ 5 \] resolution: Fixed \[ 1 \] Fix Version: 2\.0 \[ 10872 \]
firebird-automations commented 4 years ago
Modified by: @pcisar status: Resolved \[ 5 \] =\> Closed \[ 6 \]