I am portuguese so I deal with characters such as ç, á, à, ã, among others.
when I do this:
I get: utf-8
So I guess I have to change it to latin1 or something but I didn't find a way to do it.
I can't even create a variable such as:
without getting an error: "SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xe1 in position 0: unexpected end of data"
This wouldn't be much of an issue in itself but when I query a database the results are also not satisfactory since I have to use a workaround to prevent it from failing immediately but that workaround still doesn't encode/decode the text in the database correctly.
for row in cur.fetchall():
for field in row:
print (field.encode(encoding='latin'), end=" ") #Using this I get weird conversions of strings such as ç or à
print (field, end=" ") #Using this I get a "fatal" error of unable to decode
Can someone please help me? I'm sure there's an easy fix..
thanks in advance!