Ben Finney wrote: >> > What should it decode to, then? >> >> UTF-8, as in tty > > But when you explicitly redirect to a file, it's not going to a TTY. > It's going to a file whose encoding isn't known unless you specify it.
ok after thinking about this, this problem exist because Python want be smart with ttys, which is in my point of view is wrong, should not encode to utf-8, because tty is in utf-8. Python should always encode to the same thing. If the default is ascii, should always encode to ascii. yeah should send to tty in ascii, if I send my code to a guy in windows which use tty with cp1000whatever , shouldn't give decoding errors and should send in ascii . If we want we change default for whatever we want, but without this "default change" Python should not change his behavior depending on output. yeah I prefer strange output for a different platform, to a decode errors. And I have /usr/bin/iconv . Thanks for attention, sorry about my very limited English. -- Sérgio M. B. -- http://mail.python.org/mailman/listinfo/python-list