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