From 89af1d08277294b8b1049d30924df3dc86888d76 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 10 May 2018 15:25:01 +0200 Subject: [PATCH] Fix unparse not taking surrogates into account --- pyrogram/client/style/markdown.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyrogram/client/style/markdown.py b/pyrogram/client/style/markdown.py index c37dd526..2092a13e 100644 --- a/pyrogram/client/style/markdown.py +++ b/pyrogram/client/style/markdown.py @@ -105,6 +105,7 @@ class Markdown: ) def unparse(self, message: str, entities: list): + message = utils.add_surrogates(message).strip() offset = 0 for entity in entities: @@ -139,4 +140,4 @@ class Markdown: message = message[:start] + message[start:].replace( sub, "{0}{1}{0}".format(style, sub), 1) - return message + return utils.remove_surrogates(message)