Django, Tomcat & Encoding
October 8, 2008 Leave a comment
First Django was not liking my name as a search term (nothing personal, my first name, François, contains a ‘c’ with a cedilla, which soften the ‘c’). Turned out that the Python method urllib.quote_plus() was croaking rather badly and needed to be replaced with the more friendly django.utils.http.urlquote_plus(). You could also use urllib.urlencode(). I just wasn’t using urllib for anything else, so I just ditched it.
So far so good….
The next issue was with Tomcat which will just assume that the URL is encoded in ISO-8859-1 regardless of what the document character encoding is set to and even if you set the character encoding of the request to UTF-8. I can understand why they did this, there is no set standard for this and early browsers assumed ISO-8859-1.