I am trying to make an environment which allows printing of unicode characters both in Python 2.7 and 3.4, under Windows.
By using Cmder / ConEmu as a terminal, UTF-8 is fully supported out of the box.
However, Python support isn't so simple.
Python 3.3+
If I set chcp 65001
, Python 3.3+ detects it and runs fine.
Python 2.7
If I set chcp 65001
it simply doesn't work at all. Python produces an error line while IPython doesn't work at all.
Apparently, by specifying set PYTHONIOENCODING=utf-8
both Python and IPython work and allows printing of some unicode characters.
For example I can do:
print u'\xc1'
but I cannot do
print u'\xc1\xc1'
which produces: IOError: [Errno 0] Error
Still, it's better than nothing, at least most Python 2.7 programs would run unmodified.
My question is that if I add
@chcp 65001 > nul
@set PYTHONIOENCODING=utf-8
to the end of cmder/vendor/init.bat
, would that have any side-effects on Python 3.3+?
Also, is there any way to let unmodified Python scripts print u'\xc1\xc1'
under Windows?