I was working with Django tonight and got this error:
UnicodeDecodeError at /blog/ 'utf-8' codec can't decode byte 0xfe in position 0: invalid start byte
Here’s my troubleshooting procedure:
1. I checked my base template (base.html) and saw I had set <meta charset="utf-16"/>
when Django was expecting utf-8.
2. I changed to utf-8, saved the file, reloaded.
3. I got the same error.
4. I spent some time looking at other code and googling. Nothing worked.
5. Finally, I copied my template, deleted base.html, created a new version and pasted in the code.
And then everything worked. I’m writing my code in PyCharm; not sure if that had anything to do with not being able to get the initial html file to change from utf-16 to utf-8.