aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--markdown/__init__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py
index 0ca0509..2bc7061 100644
--- a/markdown/__init__.py
+++ b/markdown/__init__.py
@@ -243,8 +243,12 @@ class Markdown:
if not source.strip():
return u"" # a blank unicode string
- # if this raises UnicodeDecodeError, that's the caller's fault.
- source = unicode(source)
+ try:
+ source = unicode(source)
+ except UnicodeDecodeError, e:
+ # Customise error message while maintaining original trackback
+ e.reason += '. -- Note: Markdown only accepts unicode input!'
+ raise
source = source.replace(util.STX, "").replace(util.ETX, "")
source = source.replace("\r\n", "\n").replace("\r", "\n") + "\n\n"