note 104287 added to function.iconv
| From: | wembaster at mp3s dot pl | Date: | Mon, 06 Jun 2011 08:21:28 +0000 |
| Subject: | note 104287 added to function.iconv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180292@lists.php.net to get a copy of this message | ||
If you want to export some utf-8 data into csv/tsv that will be readable by excel with correct
encoding you must add special non vissable characters at the begining of file
<?
$data = "Some utf-8 characters Ä
ÄżźÄÅ"
header("Content-Type: application/octet-stream");
header("Content-Transfer-Encoding: binary");
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
header('Content-Disposition: attachment; filename = "Export
'.date("Y-m-d").'.tsv"');
header('Pragma: no-cache');
//these characters will make correct encoding to excel
echo chr(255).chr(254).iconv("UTF-8", "UTF-16LE//IGNORE", $data);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 89.25.186.114
----
Manual Page -- http://www.php.net/manual/en/function.iconv.php
Edit -- https://master.php.net/note/edit/104287
Del: integrated -- https://master.php.net/note/delete/104287/integrated
Del: useless -- https://master.php.net/note/delete/104287/useless
Del: bad code -- https://master.php.net/note/delete/104287/bad+code
Del: spam -- https://master.php.net/note/delete/104287/spam
Del: non-english -- https://master.php.net/note/delete/104287/non-english
Del: in docs -- https://master.php.net/note/delete/104287/in+docs
Del: other reasons-- https://master.php.net/note/delete/104287
Reject -- https://master.php.net/note/reject/104287
Search -- https://master.php.net/manage/user-notes.php