Characters Encoding Problem

Topics: Developer Forum, Project Management Forum, User Forum
Apr 9, 2010 at 2:19 PM

Hi guys, first of all id like to say thanks for this amazing community!

Well im developing a application with PHPExcel but different of other topics im having a different problem...

My PHP IDE: Set as UTF-8 Encoding Page, PHPExcel 1,7,2

 

Here is the issue, im reading some data from MS SQL Server and save in some vars... e.g: $Mensagem

When i echo this var i can see it properly, eg: Mensagem: Início de sessão id:29576b49044ddb4644450f8bee43aed5 (in the same page)

However, when i set the cell value i get that: Mensagem: Início de sessão id:29576b49044ddb4644450f8bee43aed5 (xls doc)

How can i resolve that?

Thanks!

Diego Ramos

1 - 09/04/2010 09:31:44  stcpadmin  I1001    STCPWEB_ACL   Início de sessão id:29576b49044ddb4644450f8bee43aed5
Apr 9, 2010 at 4:47 PM
Edited Apr 9, 2010 at 5:09 PM

Just some extra information...

If i put $objPHPExcel->setCellValue('B'.($i+7),$i++ . " - ". $Data . "  " . $CodOperador . "  " . $CodOperacao . "  " . $Modulo . "  " . "Mensagem: Início de sessão id:29576b49044ddb4644450f8bee43aed5"); works!!! but if i put $objPHPExcel->setCellValue('B'.($i+7),$i++ . " - ". $Data . "  " . $CodOperador . "  " . $CodOperacao . "  " . $Modulo . "  " . $Mensagem); it doesnt work and i get the problem with the characters!

What is the difference if i insert directly a string or insert a variable???

Function html_entity_decode doesnt work with PHPExcel? that should resolve my problem!

Help plz!

Apr 12, 2010 at 4:56 PM
Edited Apr 12, 2010 at 4:57 PM

I solved the problem my myself... you MUST use all the parameters of html_entity_decode cause it uses ISO-8859-1!!!!

 

Eg: html_entity_decode($Mensagem,ENT_QUOTES,'UTF-8');