I have a problem with keeping letters with an accent. I am using POSTGRESQL and Python 2.7
POSTGRESQL - ENCODING = 'LATIN1'
I already added this line, but it will not work!
#!/usr/bin/python
Details of the error message:
UnicodeDecodeError: 'utf8' codec can't decode byte 0xed
Please any idea how to fix this?
@Edit:
cur = conn.cursor() cur.execute("SELECT * FROM users") rows = cur.fetchall() obj_list = list() for row in rows: ob = dict() ob['ID'] = row[0] ob['NAME'] = row[1] ob['CITY'] = row[2] ob['USERNAME'] = row[3] obj_list.append(ob) # print obj_list # sys.exit() def add_object(ob, row): ws.cell(column=3, row=row).value = ob['ID'] ws.cell(column=4, row=row).value = ob['NAME'] ws.cell(column=6, row=row).value = ob['CITY'] ws.cell(column=8, row=row).value = ob['USERNANE']
This part of the code is causing an error. It returns the accent ..
ob['CITY'] = row[2]
source share