Pages

Wednesday, March 26, 2014

file_get_contents not working with utf8 - [resolved]

If you want to encode special characters from "file_get_contents" than please write below code:

$stringCnt = file_get_contents("URL");
$stringCnt = mb_convert_encoding($stringCnt, 'UTF-8', mb_detect_encoding($stringCnt, 'UTF-8, ISO-8859-1', true));

You can encode "¡ÅѺ˹éÒáá¾ÃФÑÁÀÕÃìÀÒÉÒä·Â©ºÑº" characters.

And If you are using other language than you have to use other encoding method.

No comments: