This is probably stupid and/or misguided but supposing I'm passed a byte-string value that I want to be unicode, this is what I do. I'm sure I'm missing something very important.
Short version : >>> s = "José" #Start with non-unicode string >>> unicoded = eval("u'%s'" % "José") Long version : >>> s = "José" #Start with non-unicode string >>> s #Lets look at it 'Jos\xe9' >>> escaped = s.encode('string_escape') >>> escaped 'Jos\\xe9' >>> unicoded = eval("u'%s'" % escaped) >>> unicoded u'Jos\xe9' >>> test = u"José" #What they should have passed me >>> test == unicoded #Am I really getting the same thing? True #Yay! -- http://mail.python.org/mailman/listinfo/python-list