How to convert HTML characters in PHPExcel?

Develop a PHP application that generates Excel documents on the fly using PHPExcel ( http://phpexcel.codeplex.com/ ).

The problem is that my Excel document will contain some special HTML characters such as °, ’, ”and etc ....

But in the generated XLS file, all I get is °, ’, ”and so on, rather than & deg ;, & rsquo ;, ", as I need to.

Can you help me how to get this in XLS docs?

+5
source share
1 answer

Remember that you should always use UTF-8 for strings in PHPExcel

$str = '32°Fahrenheit = 0°Centigrade';
$str = html_entity_decode($str,ENT_QUOTES,'UTF-8');
+10
source

All Articles