[Python-Dev] forwarded message from aahz@panix.com

aahz@pobox.com aahz@pobox.com
Thu, 5 Oct 2000 12:52:47 -0700 (PDT)

> [Aahz]
>> Someone just pointed out on c.l.py that we need an HTMLescape() function
>> that takes a string and converts special characters to entities.  I'm
>> not on python-dev, so could you please forward this and find out whether
>> I need to run a PEP?
> Has someone pointed out yet that this is done by cgi.escape()?

Yeah, I missed that earlier.  But after thinking some more, there are a
fair number of browser-like bits of software that fail to render many of
the special characters correctly (e.g. trademark).  This is frequently
due to character set issues; entities almost always render correctly,
though.  Therefore a general translation routine is probably handy.

cgi.escape() only handles "&", "<", ">".  I'm not sure whether cgi.escape
ought to be expanded to handle all characters or a new routine should be
added.  Martin van Loewis suggested xml.sax.saxutils.escape(), but I
have zero familiarity with XML and am waiting for 2.0final.  Perhaps
this should be taken off-line?
                      --- Aahz (Copyright 2000 by aahz@pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

There's a difference between a person who gets shit zie doesn't
deserve and a person who gets more shit than zie deserves.  --Aahz