mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-18 08:02:49 +01:00
Use 'unicode_escape' in utils.str.dqrepr if running Python 3.
This commit is contained in:
parent
0a4a12243d
commit
8af6761275
@ -120,7 +120,8 @@ def dqrepr(s):
|
||||
"""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.
|
||||
# return '"' + repr("'\x00" + s)[6:]
|
||||
return '"%s"' % s.encode('string_escape').replace('"', '\\"')
|
||||
encoding = 'string_escape' if sys.version_info[0] < 3 else 'unicode_escape'
|
||||
return '"%s"' % s.encode(encoding).decode().replace('"', '\\"')
|
||||
|
||||
def quoted(s):
|
||||
"""Returns a quoted s."""
|
||||
|
Loading…
Reference in New Issue
Block a user