print u"\u0432": why is this so hard? UnciodeEncodeError

Hye-Shik Chang perky at i18n.org
Thu Apr 8 20:36:26 EDT 2004


On Thu, Apr 08, 2004 at 08:51:18PM +0200, "Martin v. L?wis" wrote:
> David Eppstein wrote:
> >Py2.3 sure doesn't discover the encoding of my terminal automatically:
> >
> >hyperbolic ~: python
> >Python 2.3 (#1, Sep 13 2003, 00:49:11) 
> >[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
> 
> Ah, Darwin. You lose.
> 
> If anybody can tell me how to programmatically discover the encoding
> of Terminal.App, I'll happily incorporate a change into a 2.3.x release.
> 

The encoding of darwin terminal can be discovered by the routine
currently we have.

perky$ LC_ALL=ko_KR.UTF-8 python
Python 2.3 (#1, Sep 13 2003, 00:49:11) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys;sys.stdin.encoding
'UTF-8'
>>> ^D
perky$ LC_ALL=ko_KR.eucKR python
Python 2.3 (#1, Sep 13 2003, 00:49:11) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys;sys.stdin.encoding
'eucKR'


Regards,
Hye-Shik




More information about the Python-list mailing list