Update functions.lib.php

This commit is contained in:
Frédéric FRANCE 2020-10-27 20:06:49 +01:00 committed by GitHub
parent 9595d56235
commit 7d30a11a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1086,27 +1086,36 @@ function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $keepmoreta
}
}
/**
* Convert a string to lower. Never use strtolower because it does not works with UTF8 strings.
*
* @param string $utf8_string String to encode
* @param string $string String to encode
* @param string $encoding Character set encoding
* @return string String converted
*/
function dol_strtolower($utf8_string)
function dol_strtolower($string, $encoding = "UTF-8")
{
return mb_strtolower($utf8_string, "UTF-8");
if (function_exists('mb_strtolower')) {
return mb_strtolower($string, $encoding);
} else {
return strtolower($string);
}
}
/**
* Convert a string to upper. Never use strtolower because it does not works with UTF8 strings.
*
* @param string $utf8_string String to encode
* @param string $string String to encode
* @param string $encoding Character set encoding
* @return string String converted
*/
function dol_strtoupper($utf8_string)
function dol_strtoupper($string, $encoding = "UTF-8")
{
return mb_strtoupper($utf8_string, "UTF-8");
if (function_exists('mb_strtoupper')) {
return mb_strtoupper($string, $encoding);
} else {
return strtoupper($string);
}
}