added support for UTF-8 documents
authorBenjamin Mako Hill <mako@yukidoke.org>
Sun, 10 Apr 2011 19:39:33 +0000 (15:39 -0400)
committerBenjamin Mako Hill <mako@yukidoke.org>
Sun, 10 Apr 2011 19:39:33 +0000 (15:39 -0400)
Fixed issue where the it would return 500 when certain unicode
characters were used.

markdown-plugin.py

index f60b9a3c6975fa274f87321bf892ed6a9b73f42d..159744507d556f518c6469d40824a31230e0c213 100644 (file)
@@ -27,7 +27,7 @@ _version__ = '0.3'
 __author__ = 'Benjamin Mako Hill <mako@atdot.cc>'
 __author__ = 'seanh <snhmnd@gmail.com>'
 
-FILENAME_EXTENSIONS = ('.txt','.text','.mkdn','.markdown','.md','.mdown','.markdn','.mkd')
+FILENAME_EXTENSIONS = ('.mdwn', '.txt','.text','.mkdn','.markdown','.md','.mdown','.markdn','.mkd')
 
 import markdown
 import os
@@ -37,6 +37,6 @@ md = markdown.Markdown(output_format='html4',extensions=['extra',])
 def cb_story(args):
        entry = args['entry']
        if os.path.splitext(entry['filename'])[1] in FILENAME_EXTENSIONS:
-               entry['body'] = md.convert(''.join(entry['body']))
+               entry['body'] = md.convert(u''.join(entry['body'].decode("utf-8")))
                md.reset()
-       return args
\ No newline at end of file
+       return args

Benjamin Mako Hill || Want to submit a patch?