A critique of cgi.escape

Jon Ribbens jon+usenet at unequivocal.co.uk
Mon Sep 25 16:05:26 CEST 2006


In article <Xns984996E6BABCEduncanbooth at 127.0.0.1>, Duncan Booth wrote:
> It is generally a principle of Python that new releases maintain backward 
> compatability. An incompatible change such proposed here would probably 
> break many tests for a large number of people.

Why is the suggested change incompatible? What code would it break?
I agree that it would be a bad idea if it did indeed break backwards
compatibility - but it doesn't.

> There should be a one-stop shop where I can take my unicode text and 
> convert it into something I can safely insert into a generated html page; 

I disagree. I think that doing it in one is muddled thinking and
liable to lead to bugs. Why not keep your output as unicode until it
is ready to be output to the browser, and encode it as appropriate
then? Character encoding and character escaping are separate jobs with
separate requirements that are better off handled by separate code.



More information about the Python-list mailing list