Character Encoding

Apr 28, 2010 at 5:58 AM


I have a problem about Thai Character Encoding.

I try to config by use iconv() function.

But It doesn't show me the correct result.

This is the part of code.....

$objPHPExcel->setActiveSheetIndex(0)->setCellValue('B3',iconv('TIS-620','UTF-8',"ทดสอบการ Export to Excel"));

I change 'TIS-620' to 'WINDOWS-874' but it still doesn't work.

Help me please...


Apr 28, 2010 at 1:43 PM
Edited Apr 28, 2010 at 1:45 PM

Hey mate!

So i had the same problem previously, and now i think im able to help you...

First of all i think utf8_encode($Message); should resolve your problem, iconv() was useless for me when i had the problem....

PHPExcel encoding must be in UTF-8!!!!


But if this doesnt work, you can force the browser to print your characters using entities, html_entity_decode($Message,ENT_QUOTES,'UTF-8').

Eg: If you want to print Caçador (Hunter in my language) you can put into $Message = Caçador, that means, ç = ç !

You have to find out the entities for YOUR language...

Try those things out =)


Good Luck!

Apr 29, 2010 at 3:17 AM


Thank you very much : D


Now,I can solve the problem.

My hosting is Linux. At first I use...'iconv' but it doesn't show me the correct result.

So I will use 'mb_convert_encoding' that I must to install php-mbstring.

After I install...It's work !!!


I can solve that problem.