Re: urllib.quote() change in 2.4.2

Titus Brown <[email protected]>
Newsgroups gmane.comp.web.quixote.user
Message-ID <[email protected]>
-> On Jan 17, 2006, at 4:34 AM, Oleg Broytmann wrote:
-> 
-> >On Mon, Jan 16, 2006 at 06:02:12PM -0500, David Binger wrote:
-> >>We just noticed that, in Python 2.4.2,
-> >>urllib.quote(u'\xe9') raises a KeyError.
-> >>
-> >>In Python 2.4.1, the exception is not raised,
-> >>and the result is '%E9'.
-> >
-> >   In any case you should not try to quote unicode strings. It's
-> >meaningless. Always .encode() it to the client encoding.
-> 
-> That is a good and interesting point.
-> 
-> Here's the background story, in case anyone is interested.
-> We ran into this here in an old function that renders a link
-> with a quoted "title" in a query string.  This was safe until
-> we started supporting unicode and non-ascii characters
-> actually appeared in titles.  We'll need to encode first,
-> as you suggest.

Sorry about this random question, but as long as we're talking about
escaping strings...

How do you escape "'"?

e.g.

<input type='text' name='blah' value='%(value)s'>

where value="contains'quotes\"of all kinds"?

thanks,
--titus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.