We are on PHP 5.6.5, we migrated from 5.3. I have an issue with htmlentities
that doesn't take the default charset that is set.
Since I have to set it because now the default_charset
is "UTF-8", I have this issue:
ini_set("default_charset", "ISO-8859-1");
$foo = "in french: sécurité"; //that is in UTF-8
//this is not the same...
$new_foo1 = htmlentities( $foo );
//return empty string
//...as this
$new_foo2 = htmlentities( $foo, ENT_COMPAT | ENT_HTML401, 'ISO-8859-1');
//return it correctly
the doc clearly says:
string htmlentities ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = ini_get("default_charset")
Its supposed the get the default charset set.
Thanks
我在PHP.INI文件中设置了default_charset,它解决了问题
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.