Question

I use pyodbc-azure 1.1.5 to connect my django project to a SQL Server db (aberration, I know) My client is SQL Server Native Client 11.0

When I try to open the corresponding change_list I get this error:

'utf8' codec can't decode byte 0xd1 in position 4: invalid continuation byte. You passed in 'ESPA\xd1A' (<type 'str'>)

The annoying character is Ñ. I've checked the encoding of my db and I got that is Modern_Spanish_CI_AS which, I believe, is equivalent to 'latin1' or 'cp1252'.

I have tried to modify the pyodb\base.py replacing wherever utf-8 appears to cp1252 or latin1 (following tips described in this issue), but the error is still referring to utf8.

What else can I do? (other than change the backend)

Was it helpful?

Solution

Ok! Finally I got it:

'unicode_results': True,

Adding a new option in Django settings db connection

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top