Re: Trying to understand this moji-bake

2014-01-25 Thread Terry Reedy
On 1/25/2014 2:13 PM, Chris Angelico wrote: On Sun, Jan 26, 2014 at 4:56 AM, Peter Pearson wrote: $ python2.7 -c "import sys; print(sys.stdin.encoding)" UTF-8 This isn't from stdin, though, it's about the interpretation of the bytes of source code without a magic cookie. According to PEP 263

Re: Trying to understand this moji-bake

2014-01-25 Thread Chris Angelico
On Sun, Jan 26, 2014 at 1:04 PM, Steven D'Aprano wrote: > If there's a bug, it is that Python 2.7 doesn't > raise SyntaxError when called with -c and there are non-ASCII literals in > the source. Instead, it seems to be defaulting to Latin-1, hence the moji- > bake. That might well be a bug! I wa

Re: Trying to understand this moji-bake

2014-01-25 Thread Steven D'Aprano
On Sat, 25 Jan 2014 17:08:56 +1100, Chris Angelico wrote: > On Sat, Jan 25, 2014 at 3:37 PM, Steven D'Aprano > 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 t

Re: Trying to understand this moji-bake

2014-01-25 Thread Oscar Benjamin
On 25 January 2014 04:37, Steven D'Aprano wrote: > > But using Python 2.7, I get a really bad case of moji-bake: > > [steve@ando ~]$ python2.7 -c "print u'ñøλπйж'" > ñøλÏйж > > However, interactively it works fine: > > [steve@ando ~]$ python2.7 -E > Python 2.7.2 (default, May 18 2012, 18:25:1

Re: Trying to understand this moji-bake

2014-01-25 Thread Chris Angelico
On Sun, Jan 26, 2014 at 4:56 AM, Peter Pearson wrote: > $ python2.7 -c "import sys; print(sys.stdin.encoding)" > UTF-8 This isn't from stdin, though, it's about the interpretation of the bytes of source code without a magic cookie. According to PEP 263 [1], the default encoding should have becom

Re: Trying to understand this moji-bake

2014-01-25 Thread Peter Pearson
On Sat, 25 Jan 2014 17:08:56 +1100, Chris Angelico wrote: > On Sat, Jan 25, 2014 at 3:37 PM, Steven D'Aprano > 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

Re: Trying to understand this moji-bake

2014-01-25 Thread wxjmfauth
Le samedi 25 janvier 2014 05:37:34 UTC+1, Steven D'Aprano a écrit : > I have an unexpected display error when dealing with Unicode strings, and > > I cannot understand where the error is occurring. I suspect it's not > > actually a Python issue, but I thought I'd ask here to start. > > > > U

Re: Trying to understand this moji-bake

2014-01-25 Thread Peter Otten
Steven D'Aprano wrote: > I have an unexpected display error when dealing with Unicode strings, and > I cannot understand where the error is occurring. I suspect it's not > actually a Python issue, but I thought I'd ask here to start. I suppose it is a Python issue -- where Python fails to guess a

Re: Trying to understand this moji-bake

2014-01-24 Thread Chris Angelico
On Sat, Jan 25, 2014 at 3:37 PM, Steven D'Aprano 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 ma

Re: Trying to understand this moji-bake

2014-01-24 Thread Cameron Simpson
On 25Jan2014 04:37, Steven D'Aprano wrote: > I have an unexpected display error when dealing with Unicode strings, and > I cannot understand where the error is occurring. I suspect it's not > actually a Python issue, but I thought I'd ask here to start. > > Using Python 3.3, if I print a unico