Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-21 Thread Armin Rigo
Hi Martin, On Tue, May 20, 2008 at 10:22:37AM +0200, Martin v. Löwis wrote: In particular, setting this environment variable would also disable the detection of whether stdout is a terminal. In this case, it seems to me that existing programs that start python as a non-interactive subprocess,

[Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
I'd like to propose a new environment variable PYTHONSTDOUTENCODING. This is meant to solve various problems that people had with Python not detecting their terminal encoding correctly; it would override any detection that Python would use for determining the encoding of stdout (and stdin - but

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread M.-A. Lemburg
On 2008-05-20 10:22, Martin v. Löwis wrote: I'd like to propose a new environment variable PYTHONSTDOUTENCODING. This is meant to solve various problems that people had with Python not detecting their terminal encoding correctly; it would override any detection that Python would use for

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Thomas Wouters
On Tue, May 20, 2008 at 10:41 AM, M.-A. Lemburg [EMAIL PROTECTED] wrote: On 2008-05-20 10:22, Martin v. Löwis wrote: I'd like to propose a new environment variable PYTHONSTDOUTENCODING. This is meant to solve various problems that people had with Python not detecting their terminal encoding

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Lennart Regebro
On Tue, May 20, 2008 at 12:16 PM, Thomas Wouters [EMAIL PROTECTED] wrote: You're forgetting about print; in Python 2.x, when stdout is connected to a terminal, the locale settings (typically the LANG, LC_ALL and LC_CTYPE environment variables) are taken into account when 'print' writes to

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Oleg Broytmann
On Tue, May 20, 2008 at 10:22:37AM +0200, Martin v. L?wis wrote: I'd like to propose a new environment variable PYTHONSTDOUTENCODING. This is meant to solve various problems that people had with Python not detecting their terminal encoding correctly; it would override any detection that Python

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread M.-A. Lemburg
On 2008-05-20 12:16, Thomas Wouters wrote: On Tue, May 20, 2008 at 10:41 AM, M.-A. Lemburg [EMAIL PROTECTED] wrote: On 2008-05-20 10:22, Martin v. Löwis wrote: I'd like to propose a new environment variable PYTHONSTDOUTENCODING. This is meant to solve various problems that people had with

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Tarek Ziadé
On Tue, May 20, 2008 at 12:48 PM, Oleg Broytmann [EMAIL PROTECTED] wrote: On Tue, May 20, 2008 at 10:22:37AM +0200, Martin v. L?wis wrote: I'd like to propose a new environment variable PYTHONSTDOUTENCODING. This is meant to solve various problems that people had with Python not detecting

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
Writing Unicode to stdout will still use the default encoding ASCII to convert it to an 8-bit string. That's not true. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
You're forgetting about print; in Python 2.x, when stdout is connected to a terminal, the locale settings (typically the LANG, LC_ALL and LC_CTYPE environment variables) are taken into account when 'print' writes to sys.stdout. Isn't it then enough to make sure your locale setting are

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
PYTHONSTDOUTENCODING could then provide the default to sys.stdout.encoding. Right - that's the proposal. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread M.-A. Lemburg
On 2008-05-20 20:23, Martin v. Löwis wrote: Writing Unicode to stdout will still use the default encoding ASCII to convert it to an 8-bit string. That's not true. Are you sure ? setenv LC_ALL de_DE.utf8 python2.5 Python 2.5 (r25:51908, May 9 2007, 00:53:06) u = u'äöü'

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
I'm not exactly sure why, since using .encoding would be useful in all cases. Right, I think it should use the file's encoding also for .write. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
Is it to override locale settings in case the user wants a different encoding? for such cases as redirected stdout, or windows console (which has an OEM encoding that differs from the locale encoding)? On Windows, the setlocale mechanism isn't used at all, since it doesn't support

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Martin v. Löwis
What about PYTHONLANG ? or something that tries to reflect which environment variables are used for this ? (LC_CTYPE - PYTHONCTYPE ? if the code uses just LC_CTYPE) It's not meant to name a locale, but an encoding. In fact, that the encoding is tied to the locale is IMO a misconception

Re: [Python-Dev] Proposal: new environment variable PYTHONSTDOUTENCODING

2008-05-20 Thread Oleg Broytmann
On Tue, May 20, 2008 at 10:22:03PM +0200, Martin v. L?wis wrote: PYTHONIOENCODING? Unprecise in a different way (as it is meant to apply only to stdout, not to all IO), but shorter. I don't think you can make it both precise and short. If you want to be precise and have both PYTHON