From: Vinay Sajip Date: Wed, 21 Oct 2009 20:22:14 +0000 (+0000) Subject: Issue #7077: logging: SysLogHandler now treats Unicode as per RFC 5424. X-Git-Tag: v3.2a1~2354 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=42ead48dc17543c0d41d261fdf070a07f576c449;p=thirdparty%2FPython%2Fcpython.git Issue #7077: logging: SysLogHandler now treats Unicode as per RFC 5424. --- diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 2d71470ceb52..2437c341aff6 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -779,6 +779,10 @@ class SysLogHandler(logging.Handler): self.encodePriority(self.facility, self.mapPriority(record.levelname)), msg) + #Message is a string. Convert to bytes as required by RFC 5424 + msg = msg.encode('utf-8') + if codecs: + msg = codecs.BOM_UTF8 + msg try: if self.unixsocket: try: diff --git a/Misc/NEWS b/Misc/NEWS index 8984e6fb035f..96ee2ac611c5 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -104,6 +104,8 @@ C-API 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.