Solved

Export Czech letters from php to excel?

Posted on 2010-09-22
3
684 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 110

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

724 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