Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.kamp.net!newsfeed.kamp.net!87.79.20.101.MISMATCH!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'causing': 0.04; 'mrab': 0.05; 'subject:Python': 0.06; '(except': 0.07; 'abuse': 0.07; 'encoded': 0.07; 'source.': 0.07; 'subject:file': 0.07; 'tkinter': 0.07; 'utf-8': 0.07; 'string': 0.09; 'exception.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'strings.': 0.09; 'yeah,': 0.09; 'jan': 0.12; "'to": 0.16; 'etc?': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'should.': 0.16; 'unexpected': 0.16; 'weird.': 0.16; 'sat,': 0.16; 'weird': 0.16; 'wrote:': 0.18; '(not': 0.18; 'looked': 0.18; 'later': 0.20; 'written': 0.21; 'feb': 0.22; '>>>': 0.22; 'memory': 0.22; 'header:User-Agent:1': 0.23; 'byte': 0.24; 'string,': 0.24; "i've": 0.25; 'this:': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'fixed': 0.29; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; 'code': 0.31; 'url:wiki': 0.31; '>>>>': 0.31; 'url:wikipedia': 0.31; 'violation': 0.31; 'themselves': 0.32; 'another': 0.32; 'ago': 0.33; 'common': 0.35; 'test': 0.35; 'but': 0.35; 'there': 0.35; 'possible': 0.36; 'url:org': 0.36; 'should': 0.36; 'represent': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'anything': 0.39; 'expect': 0.39; 'heard': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'received:173': 0.61; 'first': 0.61; 'such': 0.63; 'become': 0.64; 'special': 0.74; 'fail.': 0.84; 'received:fios.verizon.net': 0.84; 'device,': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Python shell wont open idle or an exisiting py file Date: Sat, 01 Feb 2014 03:51:48 -0500 References: <24EAA33389A147D8BC08B029E2209E16@UserPC> <52EC61FF.4060204@mrabarnett.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391244731 news.xs4all.nl 2929 [2001:888:2000:d::a6]:48140 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65206 On 2/1/2014 2:26 AM, Chris Angelico wrote: > On Sat, Feb 1, 2014 at 4:46 PM, Terry Reedy wrote: >> On 1/31/2014 10:36 PM, Chris Angelico wrote: >>> >>> On Sat, Feb 1, 2014 at 1:54 PM, MRAB wrote: >>>> >>>> I think that some years ago I heard about a variation on UTF-8 >>>> (Microsoft?) where codepoint U+0000 is encoded as 0xC0 0x80 so that the >>>> null byte can be used as the string terminator. >>>> >>>> I had a look on Wikipedia found this: >>>> >>>> http://en.wikipedia.org/wiki/Null-terminated_string >>> >>> >>> Yeah, it's a common abuse of UTF-8. It's a violation of spec, but an >>> understandable one. However, I don't understand why the first part - >>> why should \0 become U+0000 but (presumably) the \a later on >>> (...cs\accel...) doesn't become U+0007, etc? >> >> >> Because only \0 has a special meaning in a C string, I should have added 'to C itself', as the string terminator. >> and Tk is written in C and uses C strings. > > Eh? I've used \a in C programs (not often but I have used it). > > It's possible that \0 is the only one that actually bombs anything > (because of C0 80 representation). \0 can bomb C byte processing by terminating it sooner than it should. Its unexpected replacement bombs utf-8 decoding. > But since \7 and \a both represent > 0x07 in a C string, I would expect there to be other problems, if it's > interpreting it as source. Ah well! Weird weird. While other control codes may have special meaning to a terminal or other device, to do not have special meaning to the operation of C string functions themselves (except possible for a 'getline' function looking for n -- but I do not remember is the C stdlib has any such functions). I am speaking from my memory of C. I have not looked at the Tk C code to see just what it did where to create the exception. I am just happy that Serhiy was able to fixed tkinter without causing another test to fail. -- Terry Jan Reedy