note 117290 added to function.htmlspecialchars

From: Date: Sun, 17 May 2015 23:59:39 +0000
Subject: note 117290 added to function.htmlspecialchars
Groups: php.notes 
Request: Send a blank email to php-notes+get-202580@lists.php.net to get a copy of this message
Be aware of the encoding of your source files!!! Some of the suggestions here make reference to workarounds where you hard-code an encoding. <?php echo htmlspecialchars('<b>Wörmann</b>'); // Why isn't this working? ?> As it turns out, it may actually be your text editor that is to blame. As of PHP 5.4, htmlspecialchars now defaults to the UTF-8 encoding. That said, many text editors default to non-UTF encodings like ISO-8859-1 (i.e. Latin-1) or WIN-1252. If you change the encoding of the file to UTF-8, the code above will now work (i.e. the ö is encoded differently in UTF-8 and ISO-8859-1, and you need the UTF-8 version). Make sure you are editing in UTF-8 Unicode mode! Check your UI or manual for how to convert files to Unicode. It's also a good idea to figure out where to look in your UI to see what the current file encoding is. ---- Server IP: 72.52.91.14 Probable Submitter: 198.84.214.150 ---- Manual Page -- http://php.net/manual/en/function.htmlspecialchars.php Edit -- https://master.php.net/note/edit/117290 Del: integrated -- https://master.php.net/note/delete/117290/integrated Del: useless -- https://master.php.net/note/delete/117290/useless Del: bad code -- https://master.php.net/note/delete/117290/bad+code Del: spam -- https://master.php.net/note/delete/117290/spam Del: non-english -- https://master.php.net/note/delete/117290/non-english Del: in docs -- https://master.php.net/note/delete/117290/in+docs Del: other reasons-- https://master.php.net/note/delete/117290 Reject -- https://master.php.net/note/reject/117290 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202580) next »