How to set encoding for fwrite?
Posted on 2005-04-26
I need to create a file, which should contain special Polish characters (such as ś) but the file is created UTF-8 encoded when perforing fwrite. I import this file to a ISO-8859-2 encoded html
but currently the page appears incorrectly due to the character set mismatch and displays ś.
Is there a way I can set encoding for php fwrite so that my file is save ISO-8859-2 encoded? Am I on the right path or is there a better way to do it.
$fhandle = fopen( 'something.txt', 'w');
fwrite( $fhandle, 'Polish Character: ś');
fclose( $fhandle );