mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 04:52:30 +00:00
Fix unparsing malformed entities, bump v1.10.10
This commit is contained in:
@@ -189,7 +189,7 @@ def unparse(text, entities, delimiters=None, url_fmt=None):
|
||||
# Otherwise we would end up with malformed text and fail to encode.
|
||||
# For example of bad input: "Hi \ud83d\ude1c"
|
||||
# https://en.wikipedia.org/wiki/UTF-16#U+010000_to_U+10FFFF
|
||||
if '\ud800' <= text[at] <= '\udfff':
|
||||
while at < len(text) and '\ud800' <= text[at] <= '\udfff':
|
||||
at += 1
|
||||
|
||||
text = text[:at] + what + text[at:]
|
||||
|
Reference in New Issue
Block a user