-
Notifications
You must be signed in to change notification settings - Fork 27
Description
When connecting with fdb + python3 to legacy databases with mixed/non-proper encodings, you receive a lot of encoding/decoding errors.
If there is no option to actually correct this databases, Firebird offers OCTETS encoding to bypass encodings entierly.
However, calling fdb.connect(..., charset='OCTETS') produces multiple errors. In fact, this never worked as intended.
The first fix is to change in ibase.py None->'latin-1'
charset_map = {
'OCTETS' : 'latin-1', # Allow to pass through unchanged.
'latin-1' is identity encoding in python (as 'octets' is in Firebird).
The second fix is in fbcore.py in build_dpb():
...
if charset and charset!='OCTETS': # added ... and charset!='OCTETS'
dpb.add_string_parameter(isc_dpb_lc_ctype, charset.upper())
...
Firebird does not allow to pass OCTETS ad LC_TYPE parameter, so we skip it.
With this two changes, I can pass charset='OCTETS' and do selects/inserts, including BLOBS.
If you are interested to merge, I can provide patch against latest version. I am not used to GitHub, so I will probably need a little help with it.