Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Export Czech letters from php to excel?

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Suggested Courses

604 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