This is a django project.
I have a simple view with 1 line in it : render_to_response('index.html'). And this index.html contains characters like "öüä" which trigger the error 'utf8' codec can't decode bytes in position 1942-1944: invalid data
.
This is straightforward error which kind of says that it can't decode because this is not utf8 , yet i can't understand how to fix it . Where exactly should i specify something .
Any suggestions ?
index.html
is most likely in a non-UTF-8 encoding, possibly ISO-8859-1 or Windows-1252. A hex editor is a good thing to use in these cases to examine how the ö
et.c. are stored.
If index.html
where in UTF-8, an ö
would correspond to two bytes, c3 b6
. If it is ISO-8859-1, it will be a single byte f6
.
To solve this, either recode the file in UTF-8 or choose the right codec.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With