note 112476 added to function.htmlspecialchars

From: Date: Thu, 20 Jun 2013 12:00:01 +0000
Subject: note 112476 added to function.htmlspecialchars
Groups: php.notes 
Request: Send a blank email to php-notes+get-195299@lists.php.net to get a copy of this message
As of PHP 5.4 they changed default encoding from "ISO-8859-1" to "UTF-8". So if you get null from htmlspecialchars or htmlentities where you have only set <?php echo htmlspecialchars($string); echo htmlentities($string); ?> you can fix it by <?php echo htmlspecialchars($string, ENT_COMPAT,'ISO-8859-1', true); echo htmlentities($string, ENT_COMPAT,'ISO-8859-1', true); ?> On linux you can find the scripts you need to fix by grep -Rl "htmlspecialchars\\|htmlentities" /path/to/php/scripts/ ---- Server IP: 212.63.222.76 Probable Submitter: 90.230.138.222 ---- Manual Page -- http://php.net/manual/en/function.htmlspecialchars.php Edit -- https://master.php.net/note/edit/112476 Del: integrated -- https://master.php.net/note/delete/112476/integrated Del: useless -- https://master.php.net/note/delete/112476/useless Del: bad code -- https://master.php.net/note/delete/112476/bad+code Del: spam -- https://master.php.net/note/delete/112476/spam Del: non-english -- https://master.php.net/note/delete/112476/non-english Del: in docs -- https://master.php.net/note/delete/112476/in+docs Del: other reasons-- https://master.php.net/note/delete/112476 Reject -- https://master.php.net/note/reject/112476 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195299) next »