hakka Posted June 11, 2008 Share Posted June 11, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/109714-newbie-with-basic-question/ Share on other sites More sharing options...
MadTechie Posted June 11, 2008 Share Posted June 11, 2008 your converting to UTF-16LE.. $unicode_str_for_Excel = chr(255).chr(254).mb_convert_encoding( $output, 'UTF-16LE', 'UTF-8'); try removing the convert ie $unicode_str_for_Excel = chr(255).chr(254).$output; Quote Link to comment https://forums.phpfreaks.com/topic/109714-newbie-with-basic-question/#findComment-562977 Share on other sites More sharing options...
hakka Posted June 11, 2008 Author Share Posted June 11, 2008 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.. :-) Quote Link to comment https://forums.phpfreaks.com/topic/109714-newbie-with-basic-question/#findComment-563059 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.