[fix] bad encode charset with php <5.4

This commit is contained in:
Knah Tsaeb 2013-08-06 17:13:53 +02:00
parent deee27e794
commit 068f7c5b05
1 changed files with 13 additions and 3 deletions

View File

@ -49,7 +49,17 @@ if (get_magic_quotes_gpc()) {
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
$ci = array_map('htmlentities', array_merge($_POST, $_GET));
/* PHP < 5.4 use htmlentities with ISO-8859-1 charset by default
* PHP > 5.4 use htmlentities with UTF-8 charset by default
* see http://php.net/manual/fr/function.htmlentities.php
*
*/
function myHtmlentities($var) {
return htmlentities($var, ENT_QUOTES, 'UTF-8');
}
$ci = array_merge($_POST, $_GET, $_COOKIE);
$ci = array_map('myHtmlentities', $ci);
$_SESSION['bc'] = $ci['bc'];
if (!file_exists($GLOBALS['config']['CONFIG_FILE']) || strlen(file_get_contents($GLOBALS['config']['CONFIG_FILE'])) == 0) {
@ -186,9 +196,9 @@ function n_print($data, $name = '') {
<fieldset style="border: 1px solid orange; padding: 5px;color:#1E1915; background-color: #fff;">';
echo '
<legend style="border:1px solid orange;padding: 1px;background-color:#eee;color:orange;">
', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], '
', basename($aBackTrace[0]['file']), ' ligne => ', $aBackTrace[0]['line'], '
</legend>';
echo '<pre style="color:#1E1915;">', htmlentities(print_r($data, 1)), '</pre>';
echo '<pre style="color:#1E1915;">', htmlentities(print_r($data, 1)), '</pre>';
echo '
</fieldset>
<br />';