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:
# Safe printing: can print any unicode string
print msg.encode(sys.getdefaultencoding(), 'replace')
# blah blah
Isn't there a way to set stdout to not care or something?