[issue22746] cgitb html: wrong encoding for utf-8

Ezio Melotti report at bugs.python.org
Fri Oct 31 18:49:33 CET 2014


Ezio Melotti added the comment:

> In normal HTML utf-8 works fine, doesn't it?

It does, in fact as long as the encoding used by the browser matches the one used in the file, no charrefs needs to be used (except > < and ").  Of course, if non-Unicode encodings are used, the range of available characters that can go directly in the HTML will be more limited, but this can be solved by using charrefs -- the browser will display the corresponding character no matter what is the encoding.  This also means that if charrefs are used for all non-ASCII characters, then the browser will be able to display the page no matter what encoding is being used (as long as it's ASCII-compatible, and most encoding are).  The downside is that it will make the source less readable and possible longer, especially if there are lot of non-ASCII characters, but if most of the characters are expected to be ASCII, using charrefs might be ok.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22746>
_______________________________________


More information about the Python-bugs-list mailing list