- Posts: 11
- Thank you received: 2
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Andreas Glenthøj wrote: That didn't work, but I instead used this solution to get is to work in Excel:
header('Content-Encoding: UTF-8');
header('Content-type: text/csv; charset=UTF-8');
header("Content-disposition: attachment; filename=filename.csv");
header("Pragma: public");
header("Expires: 0");
echo "\xEF\xBB\xBF"; // UTF-8 BOM
The key was the last line (the BOM), which is necessary for Excel to recognize UTF-8. I persume that this is the important line. I found the solution here:
stackoverflow.com/questions/4348802/how-...l-will-read-properly
Please Log in or Create an account to join the conversation.
Dimitris Meimaris wrote: Ok, I made it work, I edit the controller.php in the administrator folder.
I commented this line:
//header('Content-Type: ' . $mime_type);
I added these two lines right after that:
header('Content-Encoding: UTF-8');
header('Content-type: text/csv; charset=UTF-8');
and I echoed the BOM just before the print:
echo "\xEF\xBB\xBF";
My lines are:
...
ob_start(); //just for reference, I haven't changed anything before this
//header('Content-Type: ' . $mime_type);
header('Content-Encoding: UTF-8');
header('Content-type: text/csv; charset=UTF-8');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
if ($UserBrowser == 'IE') {
header('Content-Disposition: attachment; filename="' . $filename . '.csv"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
}
else {
header('Content-Disposition: attachment; filename="' . $filename . '.csv"');
header('Pragma: no-cache');
}
echo "\xEF\xBB\xBF";
print $csv_output;
exit();
....
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
administrator/components/com_eventbookingI can't find the controller.php in this location (administrator/components/)
Please Log in or Create an account to join the conversation.