mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-05 12:40:22 +03:00
add_surrogate bug fix
This commit is contained in:
parent
2e1be01ad4
commit
2149ed07d1
|
@ -40,7 +40,7 @@ def add_surrogate(text):
|
||||||
# SMP -> Surrogate Pairs (Telegram offsets are calculated with these).
|
# SMP -> Surrogate Pairs (Telegram offsets are calculated with these).
|
||||||
# See https://en.wikipedia.org/wiki/Plane_(Unicode)#Overview for more.
|
# See https://en.wikipedia.org/wiki/Plane_(Unicode)#Overview for more.
|
||||||
''.join(chr(y) for y in struct.unpack('<HH', x.encode('utf-16le')))
|
''.join(chr(y) for y in struct.unpack('<HH', x.encode('utf-16le')))
|
||||||
if (0x10000 <= ord(x) <= 0x10FFFF) else x for x in text
|
if (0x10000 <= ord(x) <= 0x10FFFF) else x for x in str(text)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user