Kent Johnson wrote:
> You can, with sys.setdefaultencoding(). See here for discussion of how:
> http://blog.ianbicking.org/illusive-setdefaultencoding.html

 > and here for arguments that this is a bad idea (mostly because it makes
 > your code non-portable):
 > http://faassen.n--tree.net/blog/view/weblog/2005/08/02/0

Thanks for the links.

I'm nervous about messing with sys.setdefaultencoding() too - partly 
because I have no idea what all the implications are.

It sure would be nice to be able to just change it for "print" though. 
Even if it's going to us ascii, it really should use "replace" or 
"ignore" -- it's much better to get something, rather than an error. 
It's just a handy utility function after all.

Maybe I can re-map print to something like:

TerminalEncoding = "utf-8"
def uni_print(object):
     sys.stdout.write(unicode(object).encode(TerminalEncoding))
     sys.stdout.write("\n")


but print is a statement, rather than a function, so I don't know how to 
do that. I may start using a utility function like that for my code, though.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[EMAIL PROTECTED]
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to