I'm using Powershell and django web framework for python. This web framework has a utility for dumping data from your database python manage.py dumpdata
. When you call this command, you will get via stdout all your database entries serialized as json (no problems with this output, everything is ok):
[
{
"model": "user.user",
"pk": "007a0078-f538-4c01-9a77-694cdd6b142f",
"fields": {
"name": "César"
}
},
...
]
So you easily can use the redirection operator > and put the output in a file python manage.py dumpdata > myfile.json
.
My issue comes after doing that (redirecting the output to a file), if I have letters with latin accents they are replaced for weird characters:
{
"model": "user.user",
"pk": "fa35df0c-5ce4-4ff0-a4c6-ee25e32930e7",
"fields": {
"name": "C¾sar"
}
},
I've also tried to set powershell and python sys stdin and out encoding to utf-8 with
-python manage.py dumpdata | out-file myfile.json -encoding utf8
-import sys; sys.stdout.reconfigure(encoding='utf-8')
But still facing the same problem.