Jump to content

Newbie with basic question...


hakka

Recommended Posts

I am sorry to post here if it is not the right place to ask. I dont really know what the question I have is because I just know what problem I have.

 

I am using a joomla component that is supposed to export a amount of data from a form on a webpage to a CSV document.

 

Export works great and CSV file looks fine. Except that the exported file skips my norwegian characters Æ Ø Å.

 

The code in the component looks like this:

 

header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
header ("Content-type: application/csv");
header ("Content-Disposition: attachment; filename=\"forme.csv\"" );

if(function_exists('mb_convert_encoding')){
	$unicode_str_for_Excel = chr(255).chr(254).mb_convert_encoding( $output, 'UTF-16LE', 'UTF-8');
    	print $unicode_str_for_Excel;
}else{
    	print $output;
}

 

The characters is saved in the database and I can see them in phpmyadmin, but when I export to CSV the norwegian characters disappear. What do I have to change in this code to be able to make this work ?

 

Please move this thread to the right place if i posted it wrong.

Link to comment
https://forums.phpfreaks.com/topic/109714-newbie-with-basic-question/
Share on other sites

I replaced the line with the one you posted. The result in the exported CSV document was just a bouch of chinese characters in one line..

 

Any more good ideas ? I know it can be tricky since most of you probably don't have the letters æ ø å on your keyboard.. :-)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.