New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When exporting to a CSV with unicode characters, contents can become garbled #3427
Comments
Please give more description and steps that you have taken. |
Seems we've seen this one before. The CSV output is likely not UTF8. |
Here is one article: https://stackoverflow.com/questions/4348802/how-can-i-output-a-utf-8-csv-in-php-that-excel-will-read-properly Then I found this on secure.php.net
|
And this one looks much more elegant:
$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); |
Please test the latest commit in the 1.2.x branch for graph_xport.php. Excel does not detect it as CSV any longer, at least not automatically, but it still looks right. |
When export a csv with Chinese word garbled
Any feedback? |
@zhanghw89, does it work for you? |
I finally solved the problem based on this url. https://kindevil.com/archives/552.html |
Please upload your modified file. |
@TheWitness, I would agree with the diagnosis and fix so far. If it needs a further review, tag me. |
I'm not happy with the fix at the point. It's able to export, but Excel no longer thinks the file is CSV, and you have to use text to columns to have Excel process the file like a normal ASCII CSV file. |
When export a csv with Chinese word garbled
Just went to the site recommend, made the one small update, and now it's loading as CSV just fine with the correct encoding. |
Describe the bug
when i export a csv with Chinese word ,it has a Chinese garbled. the version is V1.2.10
The text was updated successfully, but these errors were encountered: