pypa/virtualenv — Issue #195: python3 virtual environments cannot handle unicode when writing to file
Author: gjb1002
Created: 2011-12-06 21:16:38+00:00
State: open

Please consider the following shell session. It seems as soon as I redirect the virtualenv python's output to a file, the encoding becomes "ascii" and hence unicode characters cannot be written. This doesn't happen when writing to a console, nor does it happen with python 2.x, nor with the system python 3.

(I'm using Python 3.1.2 on Ubuntu 10.04 if that's relevant)

$ python3 ~/Downloads/virtualenv-1.7/virtualenv.py ~/.local/python3
New python executable in /home/geoff/.local/python3/bin/python3
Also creating executable in /home/geoff/.local/python3/bin/python
Installing distribute............................................................................................................................................................................................................................................................................................................................................................done.
Installing pip...............done.
$ /home/geoff/.local/python3/bin/python -c "import sys; print(sys.stdout.encoding)"
UTF-8
$ /home/geoff/.local/python3/bin/python -c "import sys; print(sys.stdout.encoding)" > file
$ cat file
ascii
$ python3 -c "import sys; print(sys.stdout.encoding)" > file
$ cat file
UTF-8