Closed wardom closed 1 year ago
See https://stackoverflow.com/questions/40626896/telegram-does-not-escape-some-markdown-characters where it is mentioned that "<" will be read as tag start and probably unrecognized.
Hi @sanderkob The default formatting options used by AsyncTelegram2 library is HTML The char '<' it's an HTML start TAG so probally the server parser expect the remaining code and this cause error.
Try switching to the MarkdownV2 formatting style.
Check the example or simply add this line:
myBot.setFormattingStyle(AsyncTelegram2::FormatStyle::HTML /* MARKDOWN */);
You can try also to encode your message text using entity name or entity number:
Result | Description | Entity Name | Entity Number |
---|---|---|---|
non-breaking space | |   | |
< | less than | < | < |
> | greater than | > | > |
& | ampersand | & | & |
" | double quotation mark | " | " |
' | single quotation mark (apostrophe) | ' | ' |
¢ | cent | ¢ | ¢ |
£ | pound | £ | £ |
¥ | yen | ¥ | ¥ |
€ | euro | € | € |
© | copyright | © | © |
® | registered trademark | ® | ® |
Hello, thank you for the replies
Added the line:
myBot.setFormattingStyle(AsyncTelegram2::FormatStyle::HTML /* MARKDOWN */);
Now the bot is able to display the char "<" when using entity names or entity numbers.
Appreciate the help and looking forward to more of your work!
Hello Tolentino, love your work!
I'm new to this, so I might be doing something wrong and apologise if so.
While tinkering, I've found that by adding "<" to an outgoing message the bot doesn't send the message. I've tried using the example codes you've provided but none of them get sent if the message includes "<".
I also tried the "echoBot" example provided. It works flawlessly but if the message includes "<" the bot will not echo the message.
This was done using the echoBot sketch. Other symbols don't seem to cause any problems.
I hope I explained well enough, please let me know if you need anymore information. Thank you for your time.