Re: How does Python get the value for sys.stdin.encoding?

2010-08-12 Thread Anssi Saari
sed on the environment. Just a related question, is looking at sys.stdin.encoding the proper way of doing things? I've been working on a script to display some email headers, some of which are encoded in MIME to various charsets. Until now I have used whatever locale.getdefaultlocale() returns as

Re: How does Python get the value for sys.stdin.encoding?

2010-08-11 Thread RG
, Feb 11 2010, 00:51:29) > > [GCC 4.2.1 (Apple Inc. build 5646)] on darwin > > Type "help", "copyright", "credits" or "license" for more information. > >>>> import sys;print sys.stdin.encoding > > UTF-8 > >>>> ^

Re: How does Python get the value for sys.stdin.encoding?

2010-08-11 Thread Benjamin Kaplan
arwin > Type "help", "copyright", "credits" or "license" for more information. >>>> import sys;print sys.stdin.encoding > UTF-8 >>>> ^D > [...@mickey:~]$ echo 'import sys;print sys.stdin.encoding' | python > None &

How does Python get the value for sys.stdin.encoding?

2010-08-11 Thread RG
ts" or "license" for more information. >>> import sys;print sys.stdin.encoding UTF-8 >>> ^D [...@mickey:~]$ echo 'import sys;print sys.stdin.encoding' | python None [...@mickey:~]$ And indeed, trying to pipe unicode into Python doesn't work, even though it

Re: sys.stdin.encoding

2006-12-11 Thread Martin v. Löwis
Leo Kislov schrieb: > Environmental variable TERMENCODING ? Heck, maybe this will catch on > and will be used by other languages, libraries, terminals, etc. It's > not really Python only problem. I also considered environment variables. This can likely be made available only in 2.6, though. Plus,

Re: sys.stdin.encoding

2006-12-11 Thread Leo Kislov
Martin v. Löwis wrote: > [EMAIL PROTECTED] schrieb: > > The following line in my code is failing because sys.stdin.encoding is > > Null. This has only started happening since I started working with > > Pydef in Eclipse SDK. Any ideas? > > > > uni=unicode(word

Re: sys.stdin.encoding

2006-12-11 Thread Leo Kislov
[EMAIL PROTECTED] wrote: > Duncan Booth skrev: > > > [EMAIL PROTECTED] wrote: > > > > > The following line in my code is failing because sys.stdin.encoding is > > > Null. > > > > I'll guess you mean None rather than Null. > > > &g

Re: sys.stdin.encoding

2006-12-11 Thread aine_canby
Duncan Booth skrev: > [EMAIL PROTECTED] 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 sc

Re: sys.stdin.encoding

2006-12-11 Thread Duncan Booth
[EMAIL PROTECTED] 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 ju

Re: sys.stdin.encoding

2006-12-11 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > The following line in my code is failing because sys.stdin.encoding is > Null. This has only started happening since I started working with > Pydef in Eclipse SDK. Any ideas? > > uni=unicode(word,sys.stdin.encoding) That's a problem with pydev

Re: sys.stdin.encoding

2006-12-11 Thread aine_canby
Duncan Booth skrev: > [EMAIL PROTECTED] wrote: > > > The following line in my code is failing because sys.stdin.encoding is > > Null. > > I'll guess you mean None rather than Null. > > > This has only started happening since I started working with > >

Re: sys.stdin.encoding

2006-12-11 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > The following line in my code is failing because sys.stdin.encoding is > Null. I'll guess you mean None rather than Null. > This has only started happening since I started working with > Pydef in Eclipse SDK. Any ideas? > > uni=unicode(word,sys

sys.stdin.encoding

2006-12-11 Thread aine_canby
The following line in my code is failing because sys.stdin.encoding is Null. This has only started happening since I started working with Pydef in Eclipse SDK. Any ideas? uni=unicode(word,sys.stdin.encoding) Thanks, Aine. -- http://mail.python.org/mailman/listinfo/python-list