note 111011 modified in migration54.incompatible by danbrown

From: Date: Thu, 17 Jan 2013 15:23:46 +0000
Subject: note 111011 modified in migration54.incompatible by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-193141@lists.php.net to get a copy of this message
Missing some chars like german umlauts after use of htmlspecialchars? That's because the third param encoding has changed it's default value in PHP 5.4 from ISO-8859-1 to UTF-8. Possible solution #1: Change your code from this ... <?php htmlspecialchars( 'äöü' ); ?> ... to this: <?php htmlspecialchars ( 'äöü' , ENT_COMPAT | ENT_HTML401 , 'ISO-8859-1' ); ?> Possible solution #2: Create a wrapper function and replace htmlspecialchars( to i.e. isohtmlspecialchars( with your IDE/editor/shell... Example of a wrapper function: <?php function isohtmlspecialchars( $str ){ return htmlspecialchars ( $str , ENT_COMPAT | ENT_HTML401 , 'ISO-8859-1' ); } ?> --was-- Missing some chars like german umlauts after use of htmlspecialchars? That's because the third param encoding has changed it's default value in PHP 5.4 from ISO-8859-1 to UTF-8. Possible solution #1: Change your code from this ... htmlspecialchars( 'äöü' ); ... to this: htmlspecialchars ( 'äöü' , ENT_COMPAT | ENT_HTML401 , 'ISO-8859-1' ); Possible solution #2: Create a wrapper function and replace htmlspecialchars( to i.e. isohtmlspecialchars( with your IDE/editor/shell... Example of a wrapper function: function isohtmlspecialchars( $str ){ return htmlspecialchars ( $str , ENT_COMPAT | ENT_HTML401 , 'ISO-8859-1' ); } http://php.net/manual/en/migration54.incompatible.php

« previous php.notes (#193141) next »