I'm getting data from a website and this is an example of a sentence I retrieved : PHA+Q29ycmlnJmVhY3V0ZTtzIGV4ZXJjaWNlcyBlbnRyYWluZW1lbnQgY2hhcGl0cmUgbW91dmVtZW50IGV0IGZvcmNlczwvcD4K
The sentence is encoded with base64 so I thought about decoding it and then encoding it back to utf-8 with python :
import base64
sentence = "PHA+Q29ycmlnJmVhY3V0ZTtzIGV4ZXJjaWNlcyBlbnRyYWluZW1lbnQgY2hhcGl0cmUgbW91dmVtZW50IGV0IGZvcmNlczwvcD4K"
base64.b64decode(sentence).decode("utf-8")
The problem is that instead of looking like this: "Corrigés exercices entrainement chapitre mouvement et forces"
, it looks like this: "Corrigés exercices entrainement chapitre mouvement et forces"
.
As you can see, the accents are completely messed up.
I'm using python 3
I do not have access to the decoded sentence using the API (I only have the base64 encoded one).
Thanks for you help.