Re: sys.stdout.write()'s bug or doc bug?

2009-01-14 Thread Steven D'Aprano
On Sun, 11 Jan 2009 19:38:48 -0800, Aahz wrote: > In article > , > Qiangning Hong wrote: >> >>So, my question is, as sys.stdout IS a file object, why it does not use >>its encoding attribute to convert the given unicode? An implementation >>bug? A documenation bug? > > Please file a bug on bug

Re: sys.stdout.write()'s bug or doc bug?

2009-01-11 Thread Aahz
In article , Qiangning Hong wrote: > >So, my question is, as sys.stdout IS a file object, why it does not >use its encoding attribute to convert the given unicode? An >implementation bug? A documenation bug? Please file a bug on bugs.python.org -- that's the only way this can be tracked. -- Aa

Re: sys.stdout.write()'s bug or doc bug?

2008-12-28 Thread Steven D'Aprano
On Sun, 28 Dec 2008 02:37:55 -0800, Qiangning Hong wrote: >> > So, my question is, as sys.stdout IS a file object, why it does not >> > use its encoding attribute to convert the given unicode? An >> > implementation bug? A documenation bug? >> >> hmm I always thought "sys.stdout" is a "file-like

Re: sys.stdout.write()'s bug or doc bug?

2008-12-28 Thread Qiangning Hong
On Dec 27, 12:31 am, Martin wrote: > Python 2.4.4 (#2, Oct 22 2008, 19:52:44) > [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> u = u"\u554a" > >>> print u > 啊 > >>> sys.stdout.write(u + "\n") > > Tracebac

Re: sys.stdout.write()'s bug or doc bug?

2008-12-26 Thread Martin
Sorry GMAIL got me again, I sent this in private first, apologies. hi, 2008/12/26 Qiangning Hong : sys.stdout.write(u) > Traceback (most recent call last): > File "", line 1, in > UnicodeEncodeError: 'ascii' codec can't encode character u'\u554a' in > position 0: ordinal not in range(128

sys.stdout.write()'s bug or doc bug?

2008-12-25 Thread Qiangning Hong
>>> u = u'\u554a' >>> print u 啊 >>> sys.stdout.write(u) Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'ascii' codec can't encode character u'\u554a' in position 0: ordinal not in range(128) >>> type(sys.stdout) >>> sys.stdout.encoding 'UTF-8' Quote from file object