Issue #7077: logging: SysLogHandler now treats Unicode as per RFC 5424.

This commit is contained in:
Vinay Sajip 2009-10-21 20:22:14 +00:00
parent cf842ad418
commit 5ac6528b91
2 changed files with 12 additions and 0 deletions

View File

@ -31,6 +31,11 @@ try:
import codecs
except ImportError:
codecs = None
try:
unicode
_unicode = True
except NameError:
_unicode = False
#
# Some constants...
@ -779,6 +784,11 @@ class SysLogHandler(logging.Handler):
self.encodePriority(self.facility,
self.mapPriority(record.levelname)),
msg)
# Treat unicode messages as required by RFC 5424
if _unicode and type(msg) is unicode:
msg = msg.encode('utf-8')
if codecs:
msg = codecs.BOM_UTF8 + msg
try:
if self.unixsocket:
try:

View File

@ -418,6 +418,8 @@ Core and Builtins
Library
-------
- Issue #7077: logging: SysLogHandler now treats Unicode as per RFC 5424.
- Issue #7099: Decimal.is_normal now returns True for numbers with exponent
larger than emax.