Tim Akinbo's Tumblelog RSS

Hi, I'm Tim Akinbo and this is my tumblelog.

Afrigator

My Popularity (by popuri.us)

Archive

Apr
24th
Sun
permalink

UnicodeErrors in Django

There are times when in your Django application, displaying unicode strings can throw an except similar to:

UnicodeDecodeError at /contact/export

‘utf8’ codec can’t decode byte 0x92 in position 2: unexpected code byte

I’ve discovered that this might be due to a LOCALE setting that doesn’t support those unicode characters. To solve this problem, you have to change your LOCALE to something like UTF-8 that supports unicode characters.

From your shell, simply type:

update-locale LANG=en_US.UTF-8

Comments (View)

blog comments powered by Disqus