- Posts: 11
- Thank you received: 2
[How to] Handle latin font in Export Registration
- franz
- Topic Author
- Offline
- New Member
in order to have the export feature to handle latin font ( i think it would work for all specific font), you will have to modify the csv_export() function in controller.php.
Just 2 lines:
//header('Content-Type: ' . $mime_type);
header('Content-Type: ' . $mime_type.'; charset=UTF-16LE');
//print $csv_output;
print mb_convert_encoding( $csv_output, 'UTF-16LE', 'UTF-8');
That means delete or desactivate (with //) the first line in the function and replace it by the second.
That's it.
Tested Only for joomla 3.1.5 with office 2007.
Please Log in or Create an account to join the conversation.
- FrankM
- Offline
- Premium Member
- Posts: 148
- Thank you received: 16
Productiv: Joomla 3.5.1 / EB 2.4.3 / PHP 7.0.5
Testsys: Joomla 3.5.1 / EB 2.4.3 / PHP 7.0.5
Sorry, english isn't my native language.
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
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.
- Tuan Pham Ngoc
- Offline
- Administrator
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.
- hafjellbonden
- Offline
- New Member
- Posts: 8
- Thank you received: 0
Please Log in or Create an account to join the conversation.
- Ingolf
- Offline
- New Member
- Posts: 19
- Thank you received: 0
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.
Support
Documentation
Information
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.