note 27018 added to function.htmlentities
| From: | Lars at dybdahl dot dk | Date: | Wed, 20 Nov 2002 15:37:47 +0000 |
| Subject: | note 27018 added to function.htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39759@lists.php.net to get a copy of this message | ||
If you ever plan to support more than ISO8859-1 characters, you should stop using htmlentities()
right now. Instead, you should:
1) Use htmlspecialchars() whereever you use htmlentities()
2) Add the character encoding you use to your html file:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
This will make sure that all characters reach the end-user of your webpages unharmed. When you
change to UTF-8, use the mb_strlen instead of strlen etc., make sure your text is in utf-8
everywhere, and use this one instead in the <head> section of your html file:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
In case you use XHTML instead of old HTML, please note that the character encoding is also specified
in the xml header. Replace this:
<?xml version="1.0" encoding="iso-8859-1"?>
with this:
<?xml version="1.0" encoding="utf-8"?>
--
http://www.php.net/manual/en/function.htmlentities.php
http://master.php.net/manage/user-notes.php?action=edit+27018
http://master.php.net/manage/user-notes.php?action=delete+27018
http://master.php.net/manage/user-notes.php?action=reject+27018