![]() |
| ||
| Porblem in UTF-8 support on CSV/EXCEL Hi, First Problem: I have a PHP script that export CSV with Japanese text, for example I download the CSV on the website then save to desktop of my computer and Open it on NOTEPAD... that works fine I could still see all the japanese text OK with no problem, but if I open the CSV file in Microsoft EXCEL, all the japanese text are busted and no longer readable. Do you know a solution for this, how could I make it work OK on MS Excel, because the user want it to view the CSV file in Excel. And my second Problem is: I have another PHP script that export data with Japanese text from database to MS Excel, if I type the Japanese text on the script it works fine but if the text came from database, my problem starts because when i Download and open it in MS Excel the japanese text That I type directly in the script as a header of the excel file is OK but the contents in japanese text populated from the database is not readable in Japanese form.... Do you have any solution for my problem.... Thanks |
| ||
| Re: Porblem in UTF-8 support on CSV/EXCEL I have the same problems with encoding in a different content - XML files. For your prob.. Does excel support utf-8 fully? Question I'm asking myself, how does excel determine encoding? When saving to the database, is the database data stored as UTF-8? PHP functions are also non-utf8 aware. For example: strlen() on a UTF-8 string would return the number of bytes in the string, not the number of UTF-8 chars which would be less since a single char is encoded in multiple bytes.. Does your code use some PHP string functions? |
| ||
| Re: Porblem in UTF-8 support on CSV/EXCEL Hi, thanks for the reply. I already found a solution on my problem, I use this kind of php function to solve my problem $str = mb_convert_encoding($str, "SJIS","UTF-8");this solve all of my encoding problem.... thanks |
| ||
| Re: Porblem in UTF-8 support on CSV/EXCEL Awesome. Just a note: in order to use the function b_convert_encoding, your php installation needs to have the mb_string extension loaded. Not all PHP installations will have this. I believe there is a sourceforge.net project however that has a mirror of the mb_string functions in PHP. This will allow you to use the mb_string functions on "any" PHP installation. |
| ||
| Re: Porblem in UTF-8 support on CSV/EXCEL Have you tried when your text contain ㈱①②~. $str = mb_convert_encoding($str, "SJIS","UTF-8"); not work for them. Best of luck Sohel Taslim |
| ||
| Re: Porblem in UTF-8 support on CSV/EXCEL Hi Guys, It seems like everyone is having this issue. This is very common problem and i have been looking for its solution for a long time too. I have't tried the mb_... function and i am not sure if this will help for all languages but here is something i have found and have tested it to make sure it works for almost all languages. This is problem with Excel NOT the data format that is exported. Here are the steps 1- download the exported CSV/XLS file from your website. 2- Open Excel 2007 3- Open a new file 4- Click the Data Menu option 5- Click "From Text" button 6- Select the file you downloaded 7- Make sure "Delimited" is selected and Press Next 8- Check the delimiter characters that you know are in your file like Comma or Tab or whatever is in your case. You can select more than one 9- Proceed to Next Step and Finich 10- Your excel file will be ready with all you data displayed correctly I hope that helps someone who has been frustrated on this. Regards Nauman |
| All times are GMT -4. The time now is 7:11 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC