hi, using PHP on a mac webserver
I need to write a file to disk in windows encoding ISO-8859-1 OR UTF 8
It is a CSV file for importing into a windows app. The app chokes on it and I've determined that the Mac server is writing the file in Mac Roman. The app needs ISO-8859-1, and can maybe do UTF8.
My problem is I can't seem to get php to convert the encoding.
I've tried all of these but it always comes out as Mac Roman according to both SubEthaEdit and Text Wrangler.
Code:
$fi['content'] = utf8_encode($fi['content']);
OR
$fi['content'] = iconv('','UTF-8',$fi['content']); // convert to unicode
OR
$fi['content'] = iconv("UTF-8","ISO-8859-1",$fi['content']); // convert uft8 to windows latin 1
OR
$fi['content'] = iconv('','ISO-8859-1',$fi['content']); // try leaving the input type loose...
followed by:
$fd = fopen($my_file, 'w');
fwrite($fd, $fi['content']);
fclose($fd);
PHP docs say this should work.
What am I missing?
thanks