mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Fix traceback when utils.str.dqrepr is given a unicode object.
This commit is contained in:
parent
6ea1347d3d
commit
6c0497d34e
@ -144,6 +144,8 @@ def dqrepr(s):
|
||||
# The wankers-that-be decided not to use double-quotes anymore in 2.3.
|
||||
# return '"' + repr("'\x00" + s)[6:]
|
||||
encoding = 'string_escape' if sys.version_info[0] < 3 else 'unicode_escape'
|
||||
if sys.version_info[0] < 3 and isinstance(s, unicode):
|
||||
s = s.encode('utf8', 'replace')
|
||||
return '"%s"' % s.encode(encoding).decode().replace('"', '\\"')
|
||||
|
||||
def quoted(s):
|
||||
|
Loading…
Reference in New Issue
Block a user