Click here to Skip to main content
15,894,190 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I send the data I read from mysql database to telegram user, the user gets underline and etc instead of new line character. So this way I can't format message text correctly.

How can I format a telegram message that is a question with 4 or more possible answers?

What else is going to be changed that I don't expect? By the way I'm sending non-english characters.
PHP
$qsBody = $rowQuestion['body']; // This is what I read from database that contains some new line characters
$strReply = $qsBody;
$strSendMethod = "SendMessage?chat_id=$ChatId&text='$strReply'";
file_get_contents( BOT_TARGET_ADDRESS . $strSendMethod );
// The message received by user contains _ instead of new line.
Posted
Comments
Mohibur Rashid 20-Aug-15 4:13am    
Which ever you enjoy :
php -r '$data=array("chat_id"=>"12", "text"=>"lost\nin\ntranslation"); echo http_build_query($data); echo "\n";'

php -r 'echo urlencode ("lost\nin\ntranslation"); echo "\n";'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900