diff options
author | Waylan Limberg <waylan@gmail.com> | 2012-07-26 07:38:51 -0700 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2012-07-26 07:38:51 -0700 |
commit | c85aaa8b58e15267e7150e9bc49cd0e4cb270641 (patch) | |
tree | e71b36e68512320b93ed7e8c4c32cd8181b16d34 | |
parent | d13c203052a8b22a92b9e096e03005bff40013d2 (diff) | |
parent | 1132f9e20cd7a5d6be809651f1034c44c32dbc0e (diff) | |
download | markdown-c85aaa8b58e15267e7150e9bc49cd0e4cb270641.tar.gz markdown-c85aaa8b58e15267e7150e9bc49cd0e4cb270641.tar.bz2 markdown-c85aaa8b58e15267e7150e9bc49cd0e4cb270641.zip |
Merge pull request #127 from svetlyak40wt/fix-piped-stdout
Fixed UnicodeEncodeError when output from markdown_py is piped
-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 |