Here’s my problem, I have a variable wrongly encoded that I want to fix. Long story short, I end up with:
myVar=u'\xc3\xa9'
which is wrong because it’s the character ‘é’ or \u00e9 UTF-8 encoded, not unicode.
None of the combinations of encode/decode I tried seem to solve the problem. I looked towards the bytearray object, but you must provide an encoding, and obviously none of them fits.
Basically I need to reinterpret the byte array into the correct encoding. Any ideas on how to do that?
Thanks.
What you should have done.
Since you didn’t show the broken code that caused the problem, all we can do is make a complex problem more complex.
This appears to be what you’re seeing.
Here’s a workaround.
Fix the code that produced the wrong stuff to begin with.