From 578a5118152d47564fc8e79b6bb7a7293f7123bd Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Thu, 8 Nov 2012 12:10:59 -0500 Subject: Updated fix for #158 for Python <2.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently, the `errors` keyword to encode was added in Python 2.7. In previous versions, it was just a positional argument. This should now work in all support versions. Thanks to @Gamma3000 for assistance in working through this issue. --- markdown/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdown/__init__.py b/markdown/__init__.py index 1b71295..75c179b 100644 --- a/markdown/__init__.py +++ b/markdown/__init__.py @@ -380,7 +380,7 @@ class Markdown: # Don't close here. User may want to write more. else: # Encode manually and write bytes to stdout. - html = html.encode(encoding, errors="xmlcharrefreplace") + html = html.encode(encoding, "xmlcharrefreplace") try: # Write bytes directly to buffer (Python 3). sys.stdout.buffer.write(html) -- cgit v1.2.3