If you have website which contains both ASCII and non ASCII character such as Chinese character and you want to detect if there is a non ASCII character in the content, you may consider to use the php function utf8_decode().
Convert the input/string to an ASCII charset and compare it back with
the original. If they’re not equal, it’s possibly contains a non ASCII character.
if (utf8_decode($string)!=$string) {
echo “The string contains non ASCII character”;
}
May be this is a dirty trick that I can think of, but after all it works for me…