The print_r() shows the chinese characters correctly, but once it's written to the file and I try to open it in Notepad, Wordpad and Microsoft Word it shows up as 美元共付é¡Â計劃
print_r($contents);
exit;
if (file_put_contents($this->outPath.$dataFile, $contents) === false) {
$this->_throwError('Error: Unable to write data file: "'.$this->outPath.$dataFile.'"');
}
I've also tried this without luck:
$handle = fopen($this->outPath.$dataFile, "w+b"); //binary mode prevents any conversion
fwrite($handle, $contents);
fclose($handle);
The text is valid UTF-8 so I'm unsure what could be the problem