4
有人可以解释为什么输出是ASCII
在下面的最后三个测试?PHP默认字符串编码
我在我自己的系统上获得了相同的结果,PHPTester.net和PhpFiddle.org。
echo mb_internal_encoding(); // UTF-8
$str = 'foobar';
echo mb_check_encoding($str, 'UTF-8'); // true
echo mb_detect_encoding($str); // ASCII
$encoded = utf8_encode($str);
echo mb_detect_encoding($encoded); // ASCII
$converted = mb_convert_encoding($str, 'UTF-8');
echo mb_detect_encoding($converted); // ASCII
很好的答案 - 感谢您的回复 – cantera