sys.stdin.encoding

Duncan Booth duncan.booth at invalid.invalid
Mon Dec 11 04:48:59 EST 2006


aine_canby at yahoo.com wrote:

> The call to sys.getdefaultencoding() returns ascii. Since I can enter
> the characters åöä on the command line in Pydef/Eclipse doesn't that
> mean that the stdin is not ascii? What should I do?
> 
I think that depends on what sort of script you are writing.

If it is just something for personal use on a single machine, or if you 
know that the same encoding is going to be used on all systems where you 
have this problem, then you could hardwire the encoding to whatever it 
should be (maybe 'latin1').

If it is to be used across a variety of systems with different encodings 
then you'll have to figure out some way to find the correct encoding.



More information about the Python-list mailing list