I'm trying to redirect the output of a python script into a new file, using the Cmder/ConEmu Tool on Windows 10. The output will be containing non-ascii characters, and I need the encoding of the new file to be UTF-8
Simplified, my script looks like this:
print('Bärlauch')
Then I use this command to redirect its output to a new file.
λ python example_script.py > new_file.txt
If I then check the properties of the file, its encoding is iso-8859-1, Latin-1.
λ file -i new_file.txt
new_file.txt: text/plain; charset=iso-8859-1
For further processing and practicability, I need it to be UTF-8. I haven't found a solution up to this point, and I've been looking for quite some time. Is it impossible to change the encoding the redirect-operator uses?
EDIT: I set the codepage to UTF-8 before running the command that creates the new file, but the encoding remains Latin-1.
λ chcp 65001