Hi, I have a problem reading a txt file to insert in the mysql db table, te sniped of this code:
file contains the in first line: "aclaración"
archivo = open('file.txt',"r")
for line in archivo.readlines():
....body = body + line
model = MyModel(body=body)
model.save()
i get a DjangoUnicodeDecodeError:
'utf8' codec can't decode bytes in position 8: invalid data. You passed in 'aclaraci\xf3n' (type 'str') Unicode error hint
The string that could not be encoded/decoded was: araci�n.
I tried to body.decode('utf-8'), body.decode('latin-1'), body.decode('iso-8859-1') without solution.
Can you help me please? Any hint is apreciated :)