summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2009-04-16 19:11:35 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2009-04-16 19:11:35 (GMT)
commitcbe744ae436405745e19cbdbc8bac911f5c861d9 (patch)
treec889313a60cb8bde480f155376886f3307369468 /Lib/logging
parentb729135eeea59cf3a8fb8fb82b1c608d85cd26b3 (diff)
downloadcpython-cbe744ae436405745e19cbdbc8bac911f5c861d9.zip
cpython-cbe744ae436405745e19cbdbc8bac911f5c861d9.tar.gz
cpython-cbe744ae436405745e19cbdbc8bac911f5c861d9.tar.bz2
Issue #5768: Change to Unicode output logic and test case for same.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 8c2a38c..6ce8364 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -764,11 +764,11 @@ class StreamHandler(Handler):
stream.write(fs % msg)
else:
try:
- if (isinstance(msg, unicode) or
- getattr(stream, 'encoding', None) is None):
- stream.write(fs % msg)
+ if (isinstance(msg, unicode) and
+ getattr(stream, 'encoding', None)):
+ stream.write(fs.decode(stream.encoding) % msg)
else:
- stream.write(fs % msg.encode(stream.encoding))
+ stream.write(fs % msg)
except UnicodeError:
stream.write(fs % msg.encode("UTF-8"))
self.flush()