Hi, when getting text via the raw_input method it's always a string (even if it contains non-ASCII characters). The problem lies in that whenever I try to check equality against a Unicode string it fails. I've tried using the unicode method to 'cast' the string to the Unicode type but this throws an exception:
>>> a = raw_input("text: ") text: おはよう >>> b = u"おはよう" >>> a == b __main__:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal False >>> type(a) <type 'str'> >>> type(b) <type 'unicode'> >>> unicode(a) Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in range(128) >>> str(b) Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128) After a couple hours of hair pulling I think it's about time to admit defeat. Any help would be appreciated! -Damian
-- http://mail.python.org/mailman/listinfo/python-list