?
Solved

Export Czech letters from php to excel?

Posted on 2010-09-22
3
Medium Priority
?
689 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 2000 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 111

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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
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.
Suggested Courses

752 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