TelegramBots: Exception on sending message with underline character

i catch exception when i want to sending underline ‘_’ to bot

org.telegram.telegrambots.TelegramApiException: Error at sendmessage: 
Bad Request: Can't parse message text: Can't find end of the entity starting at byte offset 264

i find that happen when i had underline character in my message text it’s seems underline is a special character in bot API like as '' in java String that must be use ‘\’ for that how can i to resolve ?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

@KilluaFein if i’m not mistaken i had to scape with \\ instead! like \\_


//should fail
String text = "My amazing text _ is really awesome";
sendMessage.setText(text);


//escape the character
String text = "My amazing text \\_ is really awesome";
sendMessage.setText(text);

Some explanations in a Java tutorial at Oracle

For me scaping _ with \ isn’t working!