Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"<" seems to break something? #108

Closed
wardom opened this issue May 1, 2023 · 3 comments
Closed

"<" seems to break something? #108

wardom opened this issue May 1, 2023 · 3 comments

Comments

@wardom
Copy link

wardom commented May 1, 2023

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.
image
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.

@sanderkob
Copy link

sanderkob commented May 1, 2023 via email

@cotestatnt
Copy link
Owner

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 &nbsp; &#160;
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
" double quotation mark &quot; &#34;
' single quotation mark (apostrophe) &apos; &#39;
¢ cent &cent; &#162;
£ pound &pound; &#163;
¥ yen &yen; &#165;
euro &euro; &#8364;
© copyright &copy; &#169;
® registered trademark &reg; &#174;

@wardom
Copy link
Author

wardom commented May 3, 2023

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!

@wardom wardom closed this as completed May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants