From c72e63cf1d6d26828cb8ab2b8e2e53a3f1c558df Mon Sep 17 00:00:00 2001 From: Prashant Sengar <45726744+prashantsengar@users.noreply.github.com> Date: Sat, 20 Jan 2024 14:26:56 +0530 Subject: [PATCH] Update within_surrogate function within_surrogate()'s second condition doesn't check for previous surrogate pair being the first (high surrogate) of the pair so it spans over all consecutive surrogates From https://t.me/TelethonChat/586037 Co-authored-by: Disk6969 --- telethon/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telethon/helpers.py b/telethon/helpers.py index 4fb9d58b..f4abe296 100644 --- a/telethon/helpers.py +++ b/telethon/helpers.py @@ -58,7 +58,7 @@ def within_surrogate(text, index, *, length=None): return ( 1 < index < len(text) and # in bounds - '\ud800' <= text[index - 1] <= '\udfff' and # previous is + '\ud800' <= text[index - 1] <= '\udbff' and # previous is '\ud800' <= text[index] <= '\udfff' # current is )