I have carefully read answers from Setting the correct encoding when piping stdout in Python but:
- the solution - export PYTHONIOENCODING=utf8does not work if you're not calling the process yourself. Example: here the process is called from Apache + mod_cgi, and running- export PYTHONIOENCODING=utf8in Bash does not change anything; I still have- import sys; print(str(sys.stdout.encoding))giving- ANSI_X3.4-1968.
- the solution - import sys, codecs sys.stdout = codecs.getwriter('utf8')(sys.stdout)- probably worked on Python 2.7 but not really for Python 3, because then, - print(s)expects- sbeing bytes, which is not very handy
Should we use a way to permanently export PYTHONIOENCODING=utf8 for all processes of the system (that is persistent, even after a reboot), if so how?
