Re: UnicodeEncodeError in compile

2012-01-11 Thread pyscripter
Indeed, on Windows NT the file system encoding should not be mbcs, since it creates UnicodeEncodeErrors on perfectly valid file names. -- http://mail.python.org/mailman/listinfo/python-list

Re: UnicodeEncodeError in compile

2012-01-11 Thread Dave Angel
On 01/11/2012 06:27 AM, pyscrip...@gmail.com wrote: Maybe the example of this question can be added to the issue 13785 as a proof that compile fails on valid file names. But I think the real issue is why on modern Windows systems the file system encoding is mbcs. Shouldn't it be utf-16? Depe

Re: UnicodeEncodeError in compile

2012-01-11 Thread pyscripter
On Wednesday, January 11, 2012 5:50:51 AM UTC+2, Terry Reedy wrote: > On 1/10/2012 3:08 AM, Terry Reedy wrote: > Is this a filename that could be an actual, valid filename on your system? Yes it is. open works on that file. > Good question. I believe this holdover from 2.x should be deleted. >

Re: UnicodeEncodeError in compile

2012-01-11 Thread jmfauth
On 11 jan, 01:56, Terry Reedy wrote: > On 1/10/2012 8:43 AM, jmfauth wrote: > > ... > > mbcs encodes according to the current codepage. Only the chinese > codepage(s) can encode the chinese char. So the unicode error is correct > and 2.7 has a bug in that it is doing "errors='replace'" when it > s

Re: UnicodeEncodeError in compile

2012-01-11 Thread jmfauth
On 11 jan, 01:56, Terry Reedy wrote: > On 1/10/2012 8:43 AM, jmfauth wrote: > > > > > D:\>c:\python32\python.exe > > Python 3.2.2 (default, Sep  4 2011, 09:51:08) [MSC v.1500 32 bit > > (Intel)] on win > > 32 > > Type "help", "copyright", "credits" or "license" for more information. > '\u5de5

Re: UnicodeEncodeError in compile

2012-01-10 Thread Terry Reedy
On 1/10/2012 3:08 AM, Terry Reedy wrote: On 1/9/2012 11:24 PM, pyscrip...@gmail.com wrote: Using python 3.2 in Windows 7 I am getting the following: compile('pass', r'c:\temp\工具\module1.py', 'exec') Is this a filename that could be an actual, valid filename on your system? UnicodeEncodeErr

Re: UnicodeEncodeError in compile

2012-01-10 Thread Terry Reedy
On 1/10/2012 8:43 AM, jmfauth wrote: D:\>c:\python32\python.exe Python 3.2.2 (default, Sep 4 2011, 09:51:08) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. '\u5de5'.encode('utf-8') b'\xe5\xb7\xa5' '\u5de5'.encode('mbcs') Traceback

Re: UnicodeEncodeError in compile

2012-01-10 Thread jmfauth
On 10 jan, 13:28, jmfauth wrote: Addendum, Python console ("dos box") D:\>c:\python32\python.exe Python 3.2.2 (default, Sep 4 2011, 09:51:08) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> '\u5de5'.encode('utf-8') b'\xe5\xb7\xa5'

Re: UnicodeEncodeError in compile

2012-01-10 Thread jmfauth
On 10 jan, 11:53, 8 Dihedral wrote: > Terry Reedy於 2012年1月10日星期二UTC+8下午4時08分40秒寫道: > > > > I get the same error running 3.2.2 under IDLE but not when pasting into > > Command Prompt. However, Command Prompt may be cheating by replacing the > > Chinese chars with '??' upon pasting, so that Pyth

Re: UnicodeEncodeError in compile

2012-01-10 Thread 88888 Dihedral
Terry Reedy於 2012年1月10日星期二UTC+8下午4時08分40秒寫道: > On 1/9/2012 11:24 PM, pyscr...@gmail.com wrote: > > Using python 3.2 in Windows 7 I am getting the following: > > > >>> compile('pass', r'c:\temp\工具\module1.py', 'exec') > > UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: >

Re: UnicodeEncodeError in compile

2012-01-10 Thread jmfauth
1) If I copy/paste these CJK chars from Google Groups in two of my interactive interpreters (no "dos/cmd console"), I have no problem. >>> import unicodedata as ud >>> ud.name('工') 'CJK UNIFIED IDEOGRAPH-5DE5' >>> ud.name('具') 'CJK UNIFIED IDEOGRAPH-5177' >>> hex(ord(('工'))) '0x5de5' >>> hex(ord('

Re: UnicodeEncodeError in compile

2012-01-10 Thread Terry Reedy
On 1/9/2012 11:24 PM, pyscrip...@gmail.com wrote: Using python 3.2 in Windows 7 I am getting the following: compile('pass', r'c:\temp\工具\module1.py', 'exec') UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: invalid character Can anybody explain why the compile state