ahserver_g/ahserver/utils.py

5 lines
131 B
Python
Raw Permalink Normal View History

2020-12-18 13:27:53 +08:00
def unicode_escape(s):
x = [ch if ord(ch) < 256 else ch.encode('unicode_escape').decode('utf-8') for ch in s]
return ''.join(x)