Reputation: 135
I need to parse french string ("Vidéo") from UTF-8 file.
But I get 'Vid\xc3\xa9o'
instead of desired sting.
I tried decode('utf-8') but it will fail with following result:
'Vid\xe9o'
How to fix this encoding issue?
Upvotes: 0
Views: 1357
Reputation: 2177
'\xe9'
is the correct representation of the unicode 'é'. \x
is the string escape sequence for a hexadecimal character and 'e9' is the hexadecimal value of the character 'é'. If you write the value of the string 'Vid\xe9o'
to a file and open it with a program which supports displaying unicode characters, it should show up as 'Vidéo'.
Upvotes: 3