Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert HTML chars in PHPExcel?

Tags:

php

phpexcel

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?

like image 271
user198003 Avatar asked Dec 22 '11 23:12

user198003


People also ask

How to convert html entity in php?

Definition and Usage. The html_entity_decode() function converts HTML entities to characters. The html_entity_decode() function is the opposite of htmlentities().

What is html entities in php?

htmlentities() Function: The htmlentities() function is an inbuilt function in PHP that is used to transform all characters which are applicable to HTML entities. This function converts all characters that are applicable to HTML entities. Syntax: string htmlentities( $string, $flags, $encoding, $double_encode )


1 Answers

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');
like image 79
Mark Baker Avatar answered Nov 03 '22 01:11

Mark Baker