The workaround to your problem is to try to encode the string in a specific encoding.
For instance:
'H€llø'.encode('utf-8')
This will cause the following error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1: ordinal not in range(128)
Now you can catch "UnicodeDecodeError" to determine that the string does not contain only ASCII characters.
try: 'H€llø'.encode('utf-8') except UnicodeDecodeError: print 'This string contains more than just the ASCII characters.'
source share