"Martin v. Löwis":
> Not a command line option. However, you can wrap sys.stdout with a
> stream that automatically performs an encoding. If all your print
> statements output Unicode strings, you can do
>
> sys.stdout = codecs.getwriter("utf-8")(sys.stdout)
It is the best solution for me.
Thanks.
My locale is set to UTF-8. The command:
python -c "print u'\u03A9'"
gives me the desired result and doesn't produce any error.
But when I want to redirect the output to a file I invoke:
python -c "print u'\u03A9'" > file.txt
I get an error:
File "", line 1, in
UnicodeEncodeError: 'ascii' codec c