Reputation: 3008
$output = "ALLWILLBEASCII";
foreach ($output as $name => $value) {
echo mb_detect_encoding( $value );
}
How to convert from ASCII to UTF-8 in PHP?
Upvotes: 2
Views: 2250
Reputation: 7183
if a character is valid ASCII, it is valid UTF-8 there is nothing to convert. http://en.wikipedia.org/wiki/UTF-8
Upvotes: 3
Reputation: 21466
You can use mb_convert_encoding() or iconv() to convert character encoding.
Upvotes: 0
Reputation: 655159
The characters of ASCII are a subset of Unicode and the code words of ASCII are also valid UTF-8. So you need no conversion as every ASCII string is also a valid UTF-8 string (but not vice versa).
Upvotes: 2