[How to] Handle latin font in Export Registration

More
10 years 8 months ago #34669 by franz
Hi every body,

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.
The following user(s) said Thank You: FrankM

Please Log in or Create an account to join the conversation.

More
10 years 8 months ago #34754 by FrankM
Works for me . Thank you.

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.

More
10 years 8 months ago #35897 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: [How to] Handle latin font in Export Registration
Another solution :

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.

More
10 years 8 months ago #35912 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: [How to] Handle latin font in Export Registration

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.

More
10 years 7 months ago #36880 by hafjellbonden
Replied by hafjellbonden on topic Re: [How to] Handle latin font in Export Registration
I can't find the controller.php in this location (administrator/components/) - is it a new filename or has it moved? I am running Event Booking version 1.6.2

Please Log in or Create an account to join the conversation.

More
10 years 6 months ago #38291 by Ingolf
In the php "echo "\xEF\xBB\xBF";" was missing, now the export ist correct- thanks for this!

I can't find the controller.php in this location (administrator/components/)

administrator/components/com_eventbooking

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc