Message18886
For some reason that I do not see,
logging.StreamHandler in Python 2.3 insists on writing
plain non-Unicode strings to the stream, and the
encoding is hard-coded as UTF-8:
if not hasattr(types, "UnicodeType"): #if
no unicode support...
self.stream.write("%s\n" % msg)
else:
try:
self.stream.write("%s\n" % msg)
except UnicodeError:
self.stream.write("%s\n" %
msg.encode("UTF-8"))
This behaviour is neither documented nor reasonable.
Files can be perfectly able to write Unicode strings
(e.g., through the use of codecs.EncodedFile or with a
default encoding of sys.stdout), and even if they are
not, UTF-8 is hardly the only choice for an encoding. I
propose to simply replace the above code with:
self.stream.write(msg)
self.stream.write("\n")
|
|
Date |
User |
Action |
Args |
2007-08-23 14:18:06 | admin | link | issue835353 messages |
2007-08-23 14:18:06 | admin | create | |
|