note 46137 added to function.htmlentities

From: Date: Thu, 30 Sep 2004 15:39:22 +0000
Subject: note 46137 added to function.htmlentities
Groups: php.notes 
Request: Send a blank email to php-notes+get-77623@lists.php.net to get a copy of this message
You don't need these custom conversion functions. This function will only work for the first 128 ascii characters if no character set is specified. If you specify the character set in an http header: <?php header('Content-type: text/html; charset=utf-8'); htmlentities('string to be encoded', ENT_QUOTES, 'utf-8'); ?> then it will work for all html entities. It outputs the named rather than the numerical entities, but html_entity_decode() will decode both numerical and textual entities (it will treat &#8364; and &euro; as the same). BTW, if you are dealing with form submitted data, it is a good idea to add the accept-charset="character set" attribute to the form as well. ---- Manual Page -- http://www.php.net/manual/en/function.htmlentities.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46137 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46137&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46137&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77623) next »