Message97183
> If we change this, the encoder should quote both single and double
> quotes - simply because it is not known whether the literal
> will use single or double quotes.
Or document that single quotes are always escaped so that the user knows he/she can safely use u''. I'm not sure if there is a use case where both would *need* to be escaped, and escaping both has a size penalty.
I've attached an untested patch that escapes both.
If both are escaped, then the behavior of the string_escape codec should also be changed for consistency (it only escapes single quotes).
> The raw_unicode_escape codec would have to be fixed as well.
I'm not sure there's anything to fix. Adding backslashes to quotes in raw strings changes the value of the string -- the backslashes prevent the quotes from ending the string literal, but they are not removed when the raw literal is evaluated.
Perhaps raw_unicode_escape should be "fixed" by raising an exception when it contains any quotes. |
|
Date |
User |
Action |
Args |
2010-01-03 23:13:08 | rhansen | set | recipients:
+ rhansen, lemburg, ezio.melotti |
2010-01-03 23:13:07 | rhansen | set | messageid: <1262560387.27.0.249041630869.issue7615@psf.upfronthosting.co.za> |
2010-01-03 23:13:06 | rhansen | link | issue7615 messages |
2010-01-03 23:13:05 | rhansen | create | |
|