Test for a unicode string

goldtech goldtech at worldpost.com
Wed Oct 24 15:09:24 EDT 2007


Hi,

I have a regular expression test in a script. When a unicode character
get tested in the regex it gives an error:

UnicodeError: ASCII decoding error: ordinal not in range(128)

Question: Is there a way to test a string for unicode chars (ie. test
if a string will throw the error cited above).

Like:
 if  unicode string:
      print  'string's line #'
 else:
      process the string

How do I do "if unicode string" cited in pseudo-code above?

Thanks, still using Python 2.1




More information about the Python-list mailing list