I'm creating csv file with UTF-8 encoding using PHP code, when i use UTF-8 encode it prints special characters not correctly,
Code :
$fp = fopen('php://temp', 'w');
fprintf($fp, chr(0xEF).chr(0xBB).chr(0xBF)); // encode to UTF8
fputcsv($fp,$row,';',chr(0));
rewind($fp);
Yii::app()->user->setState('export',stream_get_contents($fp));
fclose($fp);
Yii::app()->request->sendFile($name.'.csv',Yii::app()->user->getState('export'));
Yii::app()->user->clearState('export');
when i use fprintf($fp, chr(0xEF).chr(0xBB).chr(0xBF));
this the file is in UTF-8 encode but special characters are wrongly displayed Honor� de Balzac 45100 Orl�ans
.
Please anyone provide me an idea to resolve this case