Zope fails badly if it can't encode a page with the chosen encoding
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 3 |
Fix Released
|
Critical
|
Albertas Agejevas |
Bug Description
If a browser says that it accepts only ISO-8859-1, and tries to get a page containing non ISO-8859-1 characters, Zope will fail badly, resulting in an error page that doesn't tell the user about the real problem.
I can think of two ways of solving this problem:
* 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 anyway, 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 that case? 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?
Another way is to encode the page in an encoding acceptable by the browser, replacing all unencodable characters with '?' or something like that.