On 05-Jun-2009, Ben Finney wrote: > Since the shell, the filesystem, and the terminal all understand > UTF-8, the redirection to a file should succeed, resulting in the > UTF-8 encoded character appearing on a line, just as with the output > to the terminal.
It seems Python is not detecting the correct encoding when its output is redirected to a file: ===== $ python -c 'import sys; sys.stderr.write(str(sys.stdout.encoding) + "\n")' UTF-8 $ python -c 'import sys; sys.stderr.write(str(sys.stdout.encoding) + "\n")' > foo None ===== Shouldn't the detected encoding of stdout be 'UTF-8' in both cases? In the first case, it's a UTF-8 terminal. In the second case, it's a pipe to a UTF-8 filesystem. -- \ “I know you believe you understood what you think I said, but I | `\ am not sure you realize that what you heard is not what I | _o__) meant.” —Robert J. McCloskey | Ben Finney <b...@benfinney.id.au>
signature.asc
Description: Digital signature