|Ned Batchelder : Blog | Code | Text | Site|
Printing Unicode from python
» Home : Blog : January 2004
So if I have Unicode strings in Python, and I print them, they get encoded using sys.getdefaultencoding(), and if that encoding can't handle a character in my string, I get a UnicodeEncodeError. Can I set things up so that the encoding is done with 'replace' for errors rather than 'strict'? As it is, I use a function instead of print:
Isn't there a way to set stdout to not care or something?