I am getting an arabic translation using google, this is my code:
header('Content-Type: text/html; charset=UTF-8');
$page=file_get_contents("http://www.google.com/translate_t?langpair=en|ar&text=hello",FILE_TEXT);
$page=substr($page,strpos($page,"TRANSLATED_TEXT")+strlen("TRANSLATED_TEXT")+2);
$page=substr($page,0,strpos($page,"';INPUT_TOOL_PATH"));
echo mb_detect_encoding($page); // edited 2015/05/26
echo mb_convert_encoding($page, 'UTF-8', 'ISO-8859-6');
If you follow the link on the file_get_contents function, you will see this word: مرحبا
But if you runs the code you will get: كرحبا
As you can see, the last (or first) character is different!
What I'm doing wrong?