On Sun, Aug 30, 2009 at 7:21 AM, Ville M. Vainio <[email protected]> wrote:

>
> On Sun, Aug 30, 2009 at 2:42 PM, Edward K. Ream<[email protected]>
> wrote:
>
> > encoded strings on output.  Of course, this leaves unanswered the
> essential
> > question of what encodings to use when reading or writing! This is a
> > complicated subject and it depends on what files are being read or
> written.
>
> I think the file handling in leo is currently ok - it doesn't rely in
> defaultencoding.


Oh good :-)

>
> You need to use sys.stdin.encoding to encode unicode to an encoding
> that can be displayed on terminal. Though, even printing byte garbage
> is better than compromising the integrity of the whole code (which is
> what defaultencoding does), since printing is used only for debug
> stuff anyway.
>
> I think using sys.stdin.encoding, and not advertising
> sys.setdefaultencoding as a solution to anything are the only concrete
> things that need to be done.
>
> The "evil" of sys.setdefaultencoding is that it appears to solve some
> problems, while it only sweeps them under the rug (and postpones
> actually fixing the bugs).


That's fine, provided there is actually a possible fix.  At present, I see
no such solution, but see below. Absent a "politically correct" fix, I am
inclined to continue sweeping things under the rug so that g.pr doesn't
produce byte hash.


> The actual fix needed for print is sys.stdin.encoding.


g.pr presently uses sys.stdout.encoding, and defaults to 'utf-8' if not
hasattr(sys.stdout),"encoding").

Should I change this to default to sys.stdout.encoding?  If so, why?

With the present code, according to the comments, g.pr will produce byte
hash if we don't set the default encoding to 'utf-8' in sitecustomize.py.

Edward

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to