Solved

Export Czech letters from php to excel?

Posted on 2010-09-22
3
678 Views
Last Modified: 2012-05-10
Hi,
I
My website exists in three different languages, english, swedish and czech and I have a function where I can export a list of customers to excel.
This function works fine when the customers are english or swedish. But not for Czech customers...


- All customers are storea as UTF-8 on the mysql server.
- For English/Swedish customers I can use either utf8_decode for each field I export, or I can use mysqli_set_charset('latin1') and fetch the whole recordset as latin1. This works fine!
- But I don't know how to do this for czech letters, utf8_decode do not support latin2, and I have tried to fetch the whole recordset as latin2, but this does not work...

I hope you understand my problem.

Thx in advance for a quick answer :):

//Jocke
0
Comment
Question by:jocke_j_78
3 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 33733028
Do you export the data as CSV you might try the http://www.php.net/recode extension to convert UTF8 to latin2 or you might try http://pear.php.net/package/SpreadSheet_Excel_writer which has support for UTF8 and thus there is no need to convert any chars (best solution)
0
 

Author Comment

by:jocke_j_78
ID: 33733164
Hi,
Thx for your reply!!

I am exporting the data as xls so option 1 is not alternative.

Option two will be my long-term solution, I never heard about it, so that will make my implementation a lot more stable,  thx a lot! As soon as I have some more time, I will for sure implement it! Perfect!

But I am going to Czech soon  to demonstrate my website/application and I don't have to much time so I am currently looking for a "quick fix" for my problem. Some code that can help me to convert my UTF-8 decoded Czech letters  to a format that Excel can understand..

//Jocke
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 33733761
Why not set up a string replacement algorithm?  See these examples for some options.
http://us.php.net/manual/en/function.str-replace.php#75566
http://us.php.net/manual/en/function.str-replace.php#63783

Good luck in CZ, ~Ray
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question