Why do the sys.stdout.encoding differ when output is piped (in Python2.x)?
python, python-2.x
Solution
Because when you use `cat` (or any pipe), you unbind the process from terminal. Python derives information about encoding from terminal settings.
You can force the encoding using enironment variable:
export PYTHONIOENCODING=utf-8
Problem
When I run the same code with different piping, why output is different? ``` % python2.7 -c 'import sys; print sys.stdout.encoding' UTF-8 % python2.7 -c 'import sys; print sys.stdout.encoding' | cat None ```