note 46137 deleted from function.htmlentities by danbrown

From: Date: Sun, 17 May 2009 17:04:47 +0000
Subject: note 46137 deleted from function.htmlentities by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154935@lists.php.net to get a copy of this message
Note Submitter: roland dot swingler at nospam dot transversal dot com ---- 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.

« previous php.notes (#154935) next »