how can I convert invalid ASCII string to Unicode?
MarkH at ActiveState.com
Wed May 9 07:14:45 CEST 2001
skip at pobox.com wrote:
> I have been blissfully ignoring Unicode. Alas, my bliss has been so rudely
> Suppose I have this string:
> s = "ö" # "o" with an umlaut
> and I'd like to convert it to UTF-8. (I know I can preface string literals
> with 'u', but that's not an option here. Pretend s was assigned from a file
> Simply executing
> u = unicode(s)
Is this what you want?
>>> s = "ö"
>>> unicode(s, "Latin-1")
More information about the Python-list