
Feb. 16, 2003
3:19 p.m.
You should use sys.getdefaultencoding() for this. Python's default encoding is "ascii", BTW, not "latin-1".
OK, but supposing I log a message with the format string u"Marc-Andr\xe9". If I use "ascii" as the encoding, an exception is raised because the code for e-acute is > 128. How best should this situation be handled? I assumed that people would be using Unicode to log messages in other languages with accented characters etc. which are typically outside the ASCII range. Regards, Vinay Sajip