PhantomBot v2.3.8 | Ubuntu 16.04.2 | Java 1.8.0_131
Hello again devs! Recently was looking into REST API and found this feature to be extremely useful when creating unique interactions on stream. And been using PHP script found on these forums ever since.
There is a problem though. REST API always shows Cyrillic characters in wrong encoding. When you send them in UTF-8, cyrillic characters appear in ISO-8859-1.
My test message is: Фантом - гордость СССР. (Phantom is a pride of USSR)
UTF8 -> Ð¤Ð°Ð½ÑÐ¾Ð¼ - Ð³Ð¾ÑÐ´Ð¾ÑÑÑ Ð¡Ð¡Ð¡Ð (ISO-8859-1)
Windows1251 - Ôàíòîì - ãîðäîñòü ÑÑÑÐ
I’ve tried many solutions including setting headers, encoding strings, etc, etc… But unfortunately nothing seems to work, latin characters always render fine in chat, but cyrillic don’t.
Script from @JustAlixe
$url = "http://myserver.de:25000/";
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, $url);
// set headers
$headers = [
'webauth: my webauth key',
'user: bot user on twitch',
'message: Фантомбот - Гордость советского союза'
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources