Re: Exporting text with chinese characters in CSV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The php script language has no bearing on the output unless you have characters In the php file itself.

We had some issue like this at work. They found a way using iconv to to it but had to change because redhats iconv isn't updated. They do something with saving the output to a utf8 encoded page and then sending it out or something. I assume you're trying to have this be used in excel?

On Mar 27, 2009, at 2:59 AM, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx> wrote:

On Fri, 2009-03-27 at 17:40 +0800, Ai Leen wrote:
Hi Everyone,

I need to export data from database with UTF-8 encoding to an csv file. I am
outputing html tables with the Content Type set to msexcel.

The chinese texts came out as symbols. I tried
using mb_convert_encoding the text from UTF-8 to UTF-16LE
iconv from UTF8 to gb2312
iconv from UTF-8 to cp1252

Can anyone who has successfully export english text with chinese characters
mixed in to CSV help?

Thank you very much,
Ai Leen


Strictly speaking, a csv file won't contain HTML markup, so you should
probably just stick to delimited value lines in your file. Have you
tried changing the Content Type to text/plain and then save your PHP
script as utf-8. It's this last one that sometimes causes problems, as I
believe it is needed for PHP to correctly output utf-8.


Ash
www.ashleysheridan.co.uk


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux