Home > database >  Convert string of unknown encoding to UTF-8
Convert string of unknown encoding to UTF-8

Time:04-19

I am consuming a text response from a third party API. This text is in an encoding which is unknown to me. I consume the text in python3 and want to change the encoding into UTF-8.

This is an example of the contents I get:

Danke
"Träume groß"
🙌ðŸ¼
Super Idee!!!

I was able to get the messed up characters readable by doing the following manually:

  1. Open new document in Notepad
  2. Via the Encoding menu switch the encoding of the document to ANSI
  3. Paste the contents
  4. Again use the Encoding menu, this time switch to UTF-8
  5. Now the text is properly legible like below

Correct content:

Danke
"Träume groß"
           
  • Related