Python unicode string gotcha
2012-02-06
Consider the following executed in python’s 2.7 interactive interpreter: >>> s = u’Ω’>>> se = s.encode(“mbcs”)>>> print s, seΩ Ω>>> s == seTrue>>> print s.lower(), se.lower()ω Ω>>> s.lower() == se.lower()False Bizarre? Not if you consider…