ahserver/ahserver/utils.py
2023-05-09 14:43:34 +08:00

5 lines
131 B
Python
Executable File

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)