6

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?

pnuts
  • 58,317
  • 11
  • 87
  • 139
user198003
  • 11,029
  • 28
  • 94
  • 152
  • 1
    Can't you just [`html_entity_decode()`](http://php.net/manual/en/function.html-entity-decode.php) the string before you use it in the Excel sheet? Or does this not work for some reason? – DaveRandom Dec 22 '11 at 23:48

1 Answers1

12

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');
Mark Baker
  • 209,507
  • 32
  • 346
  • 385