0
我们使用PHP 5.6.5,我们从5.3迁移。我有一个htmlentities
的问题,它没有采用设置的默认字符集。使用默认字符集的PHP 5.6 htmlentities
因为我必须设置它,因为现在default_charset
是 “UTF-8”,我有这样的问题:
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
商务部明确表示:
string htmlentities (string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = ini_get("default_charset")
其所谓的获得默认字符集。
感谢