PHP Default String Encoding

Viewed 285

Could someone explain why the output is ASCII in the last three tests below?

I get the same results on my own system, PHPTester.net, and 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
1 Answers
Related