Possible Duplicate:
How do I detect non-ASCII characters in a string?
I have an array representing a US-ASCII transliteration table, liket this one:
http://www.geopostcodes.com/encoding#az
If the string has one of those characters, then I replace it with the ASCII correspondent (with strtr).
Because the array is huge, I wish to load it into a variable and transliterate the string only if the string contains these type of UTF-8 characters.
Is there a decently fast way to find this out?
There is no real way to do this. However, if you don’t need any codepoints above ASCII 127 (so no “extended ASCII” like éáÿ), you can check if any bytes have the first bit set: