Solved

Export Czech letters from php to excel?

Posted on 2010-09-22
3
670 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 108

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now