note 104342 modified in function.mb-convert-encoding by danbrown
| From: | danbrown@php.net | Date: | Thu, 09 Jun 2011 18:44:13 +0000 |
| Subject: | note 104342 modified in function.mb-convert-encoding by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180391@lists.php.net to get a copy of this message | ||
I was having trouble parsing an Excel document to html, this seems to do the trick for character
encoding.
<?php
function decode_characters($info)
{
$info = mb_convert_encoding($info, "HTML-ENTITIES", "UTF-8");
$info = preg_replace('~^(&([a-zA-Z0-9]);)~',htmlentities('${1}'),$info);
return($info);
}
?>
--was--
I was having trouble parsing an Excel document to html, this seems to do the trick for character
encoding.
function decode_characters($info)
{
$info = mb_convert_encoding($info, "HTML-ENTITIES", "UTF-8");
$info = preg_replace('~^(&([a-zA-Z0-9]);)~',htmlentities('${1}'),$info);
return($info);
}
http://php.net/manual/en/function.mb-convert-encoding.php