WTF? Printing unicode strings
Serge Orlov
Serge.Orlov at gmail.com
Thu May 18 20:22:19 EDT 2006
More information about the Python-list mailing list
Thu May 18 20:22:19 EDT 2006
- Previous message (by thread): WTF? Printing unicode strings
- Next message (by thread): WTF? Printing unicode strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ron Garret wrote: > In article <1147992722.970761.220840 at j73g2000cwa.googlegroups.com>, > "Serge Orlov" <Serge.Orlov at gmail.com> wrote: > > > Ron Garret wrote: > > > In article <mailman.5906.1147989402.27775.python-list at python.org>, > > > Robert Kern <robert.kern at gmail.com> 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? > > > > Exact answer depends on what OS and terminal you are using and what > > your program is supposed to do, are you going to distribute the program > > or it's just for internal use. > > I'm using an OS X terminal to ssh to a Linux machine. In theory it should work out of the box. OS X terminal should set enviromental variable LANG=en_US.utf-8, then ssh should transfer this variable to Linux and python will know that your terminal is utf-8. Unfortunately AFAIK OS X terminal doesn't set that variable and most (all?) ssh clients don't transfer it between machines. As a workaround you can set that variable on linux yourself . This should work in the command line right away: LANG=en_US.utf-8 python -c "print unichr(0xbd)" Or put the following line in ~/.bashrc and logout/login export LANG=en_US.utf-8
- Previous message (by thread): WTF? Printing unicode strings
- Next message (by thread): WTF? Printing unicode strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list