Ascii problems running script

Asked

Viewed 41 times

0

Good afternoon,

I am developing a simple script that needs to take data from an ascii encoded database, however I am getting an error message regarding utf-8 formatting.

code snippet:

cur.execute('SELECT * from cadpro')
recset = cur.fetchall()
for rec in recset:
  print(rec)

error message:

recset = cur.fetchall()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc7 in position 14: ordinal not in range(128)
  • You need to put more things on this question in order to be able to answer. Which database is it? How is the connection made? Your bank is not in "pure ASCII", otherwise it would not have that character there - it can be a prefix of a character in utf-8, but it can also be "Ç" if it is encoded in latin-1.

  • Good morning, I am using Postgresql and making connection with psycopg2, by default the client database installation is selected the model as ASCII, the idea of the script is to make changes in the database using sql commands.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.