I'm trying to write a php telegram bot in Persian which is a non English utf8 language. when I try to send plain text in Persian to my client it works perfectly ok
$array = [
"chat_id" => $chat_id,
"text" => $someNonEnglishText
];
$telegram->sendMessage($array);
but when I try to send keyboard data with the code below it just show some question marks like ???????????????? on my keyboard buttons
$reply_markup = $telegram->replyKeyboardMarkup([
'keyboard' => $someNonEnglishkeyboard,
'resize_keyboard' => true,
'one_time_keyboard' => true
]);
$telegram->sendMessage([
'chat_id' => $updates[0]->getMessage()->getChat()->getId(),
'text' => $something,
'reply_markup' => $reply_markup
]);
an I'm perfectly sure that my bot php file is utf8 by running the following command in terminal file myfile.php whilch I got the answer: surveyBot.php: PHP script, UTF-8 Unicode text
can someone help?
ps:the above code works perfectly fine for English keyboard.
Instead of using specific telegram framework, use following code (just for test purposes). Change
chat_id
andBOT_TOKEN
variables. When this code runs, if you receive healthy keyboard then your framework has problem withutf-8
.($telegram belonging class in your code)