string_escape is better than unicode_escape.

This commit is contained in:
Jeremy Fincher 2003-08-17 06:28:05 +00:00
parent f2bb968030
commit e3364e0fdd

View File

@ -211,7 +211,7 @@ def dqrepr(s):
"""Returns a repr() of s guaranteed to be in double quotes.""" """Returns a repr() of s guaranteed to be in double quotes."""
# The wankers-that-be decided not to use double-quotes anymore in 2.3. # The wankers-that-be decided not to use double-quotes anymore in 2.3.
# return '"' + repr("'\x00" + s)[6:] # return '"' + repr("'\x00" + s)[6:]
return '"%s"' % s.encode('unicode_escape').replace('"', '\\"') return '"%s"' % s.encode('string_escape').replace('"', '\\"')
nonEscapedSlashes = re.compile(r'(?<!\\)/') nonEscapedSlashes = re.compile(r'(?<!\\)/')
def perlReToPythonRe(s): def perlReToPythonRe(s):