Tomek Toczyski <[EMAIL PROTECTED]> writes: > Are there any command line option for telling python what encoding to > use for stdout? > > To be honest I have a more complicated program than the example that I > have presented - there are many print commands inside and it is not > very feasible for me to put .encode('utf-8') inside every print > occurence.
You can use sitecustomize.py [1]_ for that purpose, e.g. create this file in your current directory: # sitecustomize.py import sys sys.setdefaultencoding('utf-8') and run Python like that: PYTHONPATH=. python -c "print u'\u03A9'" > file.txt But remember that when you copy this file to the global PYTHONPATH on your system it will affect all Python programs. .. [1] http://docs.python.org/lib/module-site.html HTH, Rob -- http://mail.python.org/mailman/listinfo/python-list