note 126647 added to function.fputcsv
| From: | encode at main dot php dot net | Date: | Tue, 30 Nov 2021 12:26:50 +0000 |
| Subject: | note 126647 added to function.fputcsv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217309@lists.php.net to get a copy of this message | ||
Regarding Excel and UTF-16LE encoding
For complete Excel compatibility (umlauts, cyrillic, chinese alphabet etc.) one needs to encode
their .csv to UTF-16LE, use tabulators (\t) as the separator and include a UTF-16LE BOM at the start
of the file.
This however can not be done by simply encoding the input for putcsv, since separators and enclosure
characters will still be written in the default encoding, and fputcsv will not accept utf-16 encoded
separator/enclosure characters.
The simple solution is to roll your own implementation of fputcsv with escaping etc., or possibly to
encode the generated .csv file after the fact.
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 87.95.210.129)
----
Manual Page -- https://php.net/manual/en/function.fputcsv.php
Edit -- https://main.php.net/note/edit/126647
Del: integrated -- https://main.php.net/note/delete/126647/integrated
Del: useless -- https://main.php.net/note/delete/126647/useless
Del: bad code -- https://main.php.net/note/delete/126647/bad+code
Del: spam -- https://main.php.net/note/delete/126647/spam
Del: non-english -- https://main.php.net/note/delete/126647/non-english
Del: in docs -- https://main.php.net/note/delete/126647/in+docs
Del: other reasons-- https://main.php.net/note/delete/126647
Reject -- https://main.php.net/note/reject/126647
Search -- https://main.php.net/manage/user-notes.php