problem with character encoding

Topics: Developer Forum
Mar 17, 2009 at 11:08 AM
Hello,

I'm having some problems with excel5.

When I try to output information out of my database, which is encoded as UTF-8, it displays the text the worng way.
For example, characters like 'é' are placed like black tilted squares with an questionmark inside of it, when I view the page-information it says that the encoding is UTF-8, so I have no idea why it goes wrong here... The problem with those strange squares is that it corrupt's my .xls file. I've tried to place functions like htmlentities, just to try things out but nothing worked, besides that I've been looking for a solution for this problem with google for 2 hours, with no result at all... Is there anyone who can help me?
Developer
Mar 17, 2009 at 4:31 PM
It sounds like the encoding trouble arises even before you're inserting the values using PHPExcel.

The most common reason for this kind of problem is that the connection character set between PHP and MySQL is set incorrectly (defaults to latin1).

Have a look at my reply in this thread. The important line is the set names 'utf8'
http://phpexcel.codeplex.com/Thread/View.aspx?ThreadId=42769

Mar 19, 2009 at 12:12 PM
Thanks a lot!

It took me a while to figure out how to execute   set names 'utf8'  within the Prado framework but it's all working now!
Mar 26, 2009 at 9:42 AM
Hello nuformer,

as I use PRADO too and i have the same problem with the character encoding, can you pls. post the way you solved within the framework? Thank you very much!

Best regards Philipp