note 82534 modified in function.htmlentities by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 16:51:24 +0000 |
| Subject: | note 82534 modified in function.htmlentities by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154898@lists.php.net to get a copy of this message | ||
Trouble when using files with different charset?
htmlentities and html_entity_decode can be used to translate between charset!
Sample function:
<?php
function utf2latin($text) {
$text=htmlentities($text,ENT_COMPAT,'UTF-8');
return html_entity_decode($text,ENT_COMPAT,'ISO-8859-1');
}
?>
--was--
Trouble when using files with different charset?
htmlentities and html_entity_decode can be used to translate between charset!
Sample function:
function utf2latin($text) {
$text=htmlentities($text,ENT_COMPAT,'UTF-8');
return html_entity_decode($text,ENT_COMPAT,'ISO-8859-1');
}
http://php.net/manual/en/function.htmlentities.php