Issue Details (XML | Word | Printable)

Key: PYFB-72
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Pavel Cisar
Reporter: Cagatay Tengiz
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
Firebird driver for Python

exception_from_status function gives an UnicodeDecodeError

Created: 18/Nov/17 11:32 PM   Updated: 13/Jul/19 09:04 AM
Component/s: None
Affects Version/s: 1.8
Fix Version/s: 2.0

 Description  « Hide
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 line 562. there is also a todo remark below this line.

best regards

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Pavel Cisar added a comment - 20/Apr/18 07:40 AM
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.