Codepage of text database columns

Nevermind, it has nothing to do with encoding.
Even if I force it bye stating:

string.encode().decode('utf-8')

It throws the same error.
It looks like the problem were the too many \n\t inside the JSON.
A simple “cleaning” strategy like:

import json
new_json = json.dumps(json.load(old_json))

solved the problem.
So the problem was the remote party’s ability to manage carriage returns and/or line feeds in the received JSON string.

2 Likes