Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telegram Bots: Encoding Plus Character / Plus Sign

I am working on a telegram bot which sends telephone numbers to my telegram account. The problem is, that a '+' is converted to a ' ' blank. So every telephone number is wrong.
E.g. '+4915733000000' turns into '4915733000000'. I've tried to use the HTML code &#43 the unicode version \u002B and the url encoding caracter %2B and none of them work.

https://api.telegram.org/botTOKEN/sendMessage?chat_id=MYID&text=Test:\u2031 Unicode:\u002B HTML:+ URL:%2B 

Result: Test:‱ Unicode: HTML:

Do you know any possiblility to send a plus sign?

Thanks!

like image 485
Böne Avatar asked May 22 '17 09:05

Böne


1 Answers

In case someone is using VBA to send Telegram messages with + in them you can replace your string like that:

Dim URL as String
Dim reURL as String

URL = "https://www.webpage.com/product+name/specifics+number" 'etc....
reURL = replace(URL, "+, "%2B")

'send message to telegram code here

For more Encoding info you can visit: https://www.w3schools.com/tags/ref_urlencode.ASP

like image 87
Ahti Avatar answered Sep 16 '22 23:09

Ahti