首页 > 解决方案 > Laravel Telegram bot 错误请求:字符串必须以 UTF-8 编码

问题描述

嗨,我在使用非英语时在 Laravel 电报机器人上遇到错误

Bad Request: strings must be encoded in UTF-8

这是我的代码。也尝试设置标题但没有运气

    Route::get('/test',function(){
       $bot_token = 'bot1773931989:xxxxx-uUGuaxfI';
        $chat_id = '-1001152xxxx';
     $message = "binance กำลัง";
   $res = Http::post("https://api.telegram.org/$bot_token/sendMessage?chat_id=$chat_id&text=$message");
   return $res;
});

感谢提前

标签: laravelutf-8telegram-bot

解决方案


推荐阅读