Yet another unicode WTF

Ben Finney ben+python at benfinney.id.au
Fri Jun 5 05:31:13 CEST 2009


Ned Deily <nad at acm.org> writes:

> $ python2.6 -c 'import sys; print sys.stdout.encoding, \
>  sys.stdout.isatty()'
> UTF-8 True
> $ python2.6 -c 'import sys; print sys.stdout.encoding, \
>  sys.stdout.isatty()' > foo ; cat foo
> None False

So shouldn't the second case also detect UTF-8? The filesystem knows
it's UTF-8, the shell knows it too. Why doesn't Python know it?

-- 
 \      “When I was born I was so surprised I couldn't talk for a year |
  `\                                        and a half.” —Gracie Allen |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list