In article <[EMAIL PROTECTED]>,
 Robert Kern <[EMAIL PROTECTED]> wrote:

> Ron Garret wrote:
> 
> > I forgot to mention:
> > 
> >>>>sys.getdefaultencoding()
> > 
> > 'utf-8'
> 
> A) You shouldn't be able to do that.

What can I say?  I can.

> B) Don't do that.

OK.  What should I do instead?

> C) It's not relevant to the encoding of stdout which determines how unicode
> strings get converted to bytes when printing them:
> 
> >>> import sys
> >>> sys.stdout.encoding
> 'UTF-8'
> >>> sys.getdefaultencoding()
> 'ascii'
> >>> print u'\xbd'
> 1⁄2

OK, so how am I supposed to change the encoding of sys.stdout?  It comes 
up as US-ASCII on my system.  Simply setting it doesn't work:

>>> import sys
>>> sys.stdout.encoding='utf-8'
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: readonly attribute
>>> 

rg
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to