On Sat, 25 Jan 2014 17:08:56 +1100, Chris Angelico <ros...@gmail.com> wrote: > On Sat, Jan 25, 2014 at 3:37 PM, Steven D'Aprano ><steve+comp.lang.pyt...@pearwood.info> wrote: >> But using Python 2.7, I get a really bad case of moji-bake: >> >> [steve@ando ~]$ python2.7 -c "print u'ñøλπйж'" >> ñøλÏйж > > What's 2.7's default source code encoding? I thought it was ascii, but > maybe it's assuming (in the absence of a magic cookie) that it's > Latin-1. > > ChrisA
I seem to be getting the same behavior as Steven: $ python2.7 -c "print u'ñøλπйж'" ñøλÏйж $ python2.7 -c "import sys; print(sys.stdout.encoding)" UTF-8 $ locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE=C LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= $ python2.7 -c "import sys; print(sys.stdin.encoding)" UTF-8 Also, my GNOME Terminal 3.4.1.1 character encoding is "Unicode (UTF-8)". HTH -- To email me, substitute nowhere->spamcop, invalid->net. -- https://mail.python.org/mailman/listinfo/python-list