On Mon, Jul 22, 2013 at 3:22 PM, Jim Mooney <[email protected]>wrote:
> On 22 July 2013 14:11, Marc Tompkins <[email protected]> wrote: > >> >> One way to deal with this is to specify an encoding: >> newchar = char.decode('cp437').encode('utf-8') >> > > Works fine, but I decided to add a dos graphics dash to the existing dash > to expand the tree > visually. Except I got a complaint from IDLE that I should add this: > > # -*- coding: utf-8 -*- > > Will that always work? Setting coding in a comment? Or am I looking at a > Linux hash line? > > I speak under correction here, but: what you're setting there is the encoding for the script file itself (and - the real point here - any strings you specify, without explicit encoding, inside the script), NOT the default encoding that Python is going to use while executing your script. Unless I'm very much mistaken, Python will still use the default encoding ('ascii' in your case) when reading strings from external files.
_______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
