-1

I am importing and excel file(.csv) which contains arabic characters and English. When I extracting the content using 'file_get_contents', Everything works great.

But the arabic string 'يض' comes out as ????

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

file_get_contents is known to often misinterpret UTF8.

Can you try something like this:

function file_get_contents_utf8($fn) {
    $content = file_get_contents($fn);
    return mb_convert_encoding($content, 'UTF-8',
        mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
}
jabbink
  • 1,271
  • 1
  • 8
  • 20