Comment 0 for bug 40494

Revision history for this message
Björn Tillenius (bjornt) wrote : Launchpad crashes if badly if the client says it doesn't accept 'utf-8'

Many of our pages require utf-8, and if a browser says that it doesn't accept utf-8, Launchpad will crash badly, producing an OOPS like OOPS-109C83.

I think there are two ways this can be solved.

  * Return some HTTP response code, I can't remember which, but
    I'm quite sure there is a special one for encoding errors.

  * Encode the page in utf-8 anyway, letting the client handle
    the error handling

The latter is probably the most acceptable solution, since most clients do handle utf-8 even though they don't say it, and it saves them from seeing an error page.

We do have to consider the encoding of the returned data though. If we send the data as ISO-8859-1, the browser will most likely send POST data as ISO-8859-1 as well. What happens if the user tries to POST non-ISO-8859-1 characters. In which encoding will the POST data be sent if the browser says utf-8 isn't acceptable, but we encode the page in utf-8 anyway?