diff options
-rw-r--r-- | markdown/__init__.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py index 149ec30..b637c88 100644 --- a/markdown/__init__.py +++ b/markdown/__init__.py @@ -373,7 +373,8 @@ class Markdown: output_file.write(html) # Don't close here. User may want to write more. else: - sys.stdout.write(html) + stdout = codecs.getwriter(encoding)(sys.stdout, errors="xmlcharrefreplace") + stdout.write(html) return self |