H
Hrvoje Niksic
Try this code:
# foo.py
import sys, codecs
stream = codecs.getwriter('utf-8')(sys.stdout)
print stream.encoding
$ python foo.py | cat
None
I expected the `encoding' attribute to be "UTF-8", since the stream
otherwise correctly functions as a utf-8 encoding stream.
Is this a bug in the stream factory returned by codecs.getwriter(...)?
If not, is there another way to determine a stream's output encoding
that would work for both default and codecs-created streams?
# foo.py
import sys, codecs
stream = codecs.getwriter('utf-8')(sys.stdout)
print stream.encoding
$ python foo.py | cat
None
I expected the `encoding' attribute to be "UTF-8", since the stream
otherwise correctly functions as a utf-8 encoding stream.
Is this a bug in the stream factory returned by codecs.getwriter(...)?
If not, is there another way to determine a stream's output encoding
that would work for both default and codecs-created streams?