This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vdvo
Recipients
Date 2003-11-03.22:45:43
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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")
History
Date User Action Args
2007-08-23 14:18:06adminlinkissue835353 messages
2007-08-23 14:18:06admincreate