How to convert HTML chars in PHPExcel?

喜你入骨 提交于 2019-12-12 10:57:44

问题


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

Problem I have is that my Excel document will contain some special HTML chars, like °, ’, ” etc...

But in generated XLS file, all I getting is °, ’, ”, etc, not °, ’, ”, like I need.

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


回答1:


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');


来源:https://stackoverflow.com/questions/8610697/how-to-convert-html-chars-in-phpexcel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!