Issue #7077: logging: SysLogHandler now treats Unicode as per RFC 5424.
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 2d71470..2437c34 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -779,6 +779,10 @@
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 8984e6f..96ee2ac 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -104,6 +104,8 @@
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.