Skip to content

Error response from API when sending underscores #114

@pitasi

Description

@pitasi

Hi there!
Thanks for your cool API, really easy to use.

I found a problem when trying to send messages that contains underscores.
I investigated a bit and I saw that:
https://api.telegram.org/botMYTOKEN/sendMessage?parse_mode=markdown&chat_id=SOMECHATID&text=Just_making_some_tests
will NOT work.

The solution is quite easy, just escape any _ character like this:
https://api.telegram.org/botMYTOKEN/sendMessage?parse_mode=markdown&chat_id=SOMECHATID&text=Just\_making\_some\_tests
and it will work without issues.

Basically, in my bot I just made str.replace("_", "\_") to make it works, but I think it should be fixed in the module.

Thanks again, and have a nice day.
Antonio

_(I'm a noob here at GitHub and with git in general, hope I'm writing in the right place :))

UPDATE: This issue happens only when you set parse_mode='markdown' sending the message and Telegram can't find a match for some _.
Now it does make sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions