summaryrefslogtreecommitdiff
path: root/sphinx/application.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/application.py')
-rw-r--r--sphinx/application.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sphinx/application.py b/sphinx/application.py
index a486069f9..ca3c40be7 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -376,7 +376,9 @@ class Sphinx(object):
wfile.write(message)
except UnicodeEncodeError:
encoding = getattr(wfile, 'encoding', 'ascii') or 'ascii'
- wfile.write(message.encode(encoding, 'replace'))
+ # wfile.write accept only str, not bytes.So, we encode and replace
+ # non-encodable characters, then decode them.
+ wfile.write(message.encode(encoding, 'replace').decode(encoding))
if not nonl:
wfile.write('\n')
if hasattr(wfile, 'flush'):