fredrik at pythonware.com
Tue Nov 30 14:46:49 CET 1999
Gerrit Holl <gerrit.holl at pobox.com> wrote:
> This is better:
> def escapeall(s):
> import htmlentitydefs
> for k, v in htmlentitydefs.items():
> s = string.replace(s, v, '&' + k)
> return s
I assume this is untested code?
> By the way, why doesn't the cgi module does this?
if you use ISO Latin 1 for your pages (which happens to
be default in HTTP/1.1, HTML 3.0, and real life), you
don't really have to quote all possible entities just be-
cause you can...
"mangling 8-bit data down to 7 bits is broken,
and has no excuses." -- linus torvalds
*) ie 5.0 users should use this link instead:
More information about the Python-list