I need to send messages containing emoji with my Telegram Bot.
So I copy/paste emoji code :nine:
for example, in my message text and send it to a user, BUT emoji didn`t work.
This is my sample code and function:
function tel_send($key, $t, $c)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.telegram.org/bot" . $key . "/sendMessage");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "cache=" . (time() / rand(1, time() - 100)) . "&text=" . $t . "&chat_id=" . $c);
$ss = curl_exec($ch);
curl_close($ch);
return $ss;
}
tel_send($key, "My number - :nine:", $val['message']['chat']['id']);
So, my question is: How can I send emoji by Telegram bot?
I faced the same issue a few days ago.. The solution is to use Bytes (UTF-8) notation from this table: http://apps.timwhitlock.info/emoji/tables/unicode
examples:
😁 \xF0\x9F\x98\x81 GRINNING FACE WITH SMILING EYES
😉 \xF0\x9F\x98\x89 WINKING FACE