Skip to content

Character encoding problem #12

@joitronix

Description

@joitronix

Environment:

Software: Python
Interbase driver: 1.0.1
Client: Debian linux 12
Server: Interbase 2020 899 Debian 12

DATABASE CHARSET: NONE
COLUMN CHARSET: NONE

Error:

Traceback (most recent call last):
File "/root/test_interbase.py", line 20, in
querie = cursor.execute(f"select * from tincidencias where codrep = {number}").fetchall()
File "/usr/local/lib/python3.9/dist-packages/interbase/ibcore.py", line 3543, in fetchall
return [row for row in self]
File "/usr/local/lib/python3.9/dist-packages/interbase/ibcore.py", line 3543, in
return [row for row in self]
File "/usr/local/lib/python3.9/dist-packages/interbase/ibcore.py", line 3309, in next
row = self.fetchone()
File "/usr/local/lib/python3.9/dist-packages/interbase/ibcore.py", line 3501, in fetchone
return self._ps._fetchone()
File "/usr/local/lib/python3.9/dist-packages/interbase/ibcore.py", line 3186, in _fetchone
return self.__XSQLDA2Tuple(self._out_sqlda)
File "/usr/local/lib/python3.9/dist-packages/interbase/ibcore.py", line 2473, in __XSQLDA2Tuple
value = b2u(value,self.__python_charset)
File "/usr/local/lib/python3.9/dist-packages/interbase/ibcore.py", line 365, in b2u
return st.decode(charset)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf1 in position 22: invalid continuation byte

TEXT IN THE COLUMN: mal olor en todo el baño, cliente cambia hab.

CODE:

import interbase

con = interbase.connect(
host="192.168.1.37",
database="D://.IB",
# database="D:\
\\DB\****.IB",
user="SYSDBA",
password="masterkey",
sql_dialect=3,
ib_library_name="/opt/interbase/lib/libgds.so",
charset="NONE"
)

cursor = con.cursor()

number = 300000
while True:
number += 1
print(number)
querie = cursor.execute(f"select * from tincidencias where codrep = {number}").fetchall()
for a in querie:
print(a)

If i change the charset to valid spanish charset ISO8859_1:

Traceback (most recent call last):
File "/root/test_interbase.py", line 20, in
querie = cursor.execute(f"select * from tincidencias where codrep = {number}").fetchall()
File "/usr/local/lib/python3.9/dist-packages/interbase/ibcore.py", line 3543, in fetchall
return [row for row in self]
File "/usr/local/lib/python3.9/dist-packages/interbase/ibcore.py", line 3543, in
return [row for row in self]
File "/usr/local/lib/python3.9/dist-packages/interbase/ibcore.py", line 3309, in next
row = self.fetchone()
File "/usr/local/lib/python3.9/dist-packages/interbase/ibcore.py", line 3501, in fetchone
return self._ps._fetchone()
File "/usr/local/lib/python3.9/dist-packages/interbase/ibcore.py", line 3192, in _fetchone
raise exception_from_status(DatabaseError,
interbase.ibcore.DatabaseError: ("Cursor.fetchone:\n- SQLCODE: -802\n- b'arithmetic exception, numeric overflow, or string truncation'\n- b'Cannot transliterate character between character sets'", -802, 335544321)

In ibexpert, all rows works ok, and i can see all data perfectly, configured with connetion with none.

Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions