This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhansen
Recipients rhansen
Date 2010-01-01.03:28:21
SpamBayes Score 4.25369e-09
Marked as misclassified No
Message-id <>
The description of the unicode_escape codec says that it produces "a
string that is suitable as Unicode literal in Python source code." [1] 
Unfortunately, this is not true as it does not escape quotes.  For example:

  print u'a\'b"c\'\'\'d"""e'.encode('unicode_escape')



I have attached a patch that fixes this issue by escaping single quotes.
 With the patch applied, the output is:


I chose to only escape single quotes because:
  1.  it simplifies the patch, and
  2.  it matches string_escape's behavior.

Date User Action Args
2010-01-01 03:28:27rhansensetrecipients: + rhansen
2010-01-01 03:28:27rhansensetmessageid: <>
2010-01-01 03:28:23rhansenlinkissue7615 messages
2010-01-01 03:28:22rhansencreate