From a4d80c76b3beff7a55e8e92adc126bb49214edee Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 31 Jan 2022 02:19:17 +0300 Subject: [PATCH] Allow middle dot in hashtags. --- td/telegram/MessageEntity.cpp | 2 +- test/message_entities.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index d643e3b05..5f645bfa2 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -318,7 +318,7 @@ static vector match_bot_commands(Slice str) { static bool is_hashtag_letter(uint32 c, UnicodeSimpleCategory &category) { category = get_unicode_simple_category(c); - if (c == '_' || c == 0x200c) { + if (c == '_' || c == 0x200c || c == 0xb7) { return true; } switch (category) { diff --git a/test/message_entities.cpp b/test/message_entities.cpp index 6c24ffba6..8bf589997 100644 --- a/test/message_entities.cpp +++ b/test/message_entities.cpp @@ -109,6 +109,7 @@ TEST(MessageEntities, hashtag) { check_hashtag(" #" + td::string(255, '1') + "a" + td::string(255, 'b') + "# ", {}); check_hashtag("#a#b #c #d", {"#c", "#d"}); check_hashtag("#test", {"#test"}); + check_hashtag("#te·st", {"#te·st"}); check_hashtag(u8"\U0001F604\U0001F604\U0001F604\U0001F604 \U0001F604\U0001F604\U0001F604#" + td::string(200, '1') + "ООО" + td::string(200, '2'), {"#" + td::string(200, '1') + "ООО" + td::string(53, '2')});