From: Sean Hammond Date: Tue, 28 Sep 2010 00:43:32 +0000 (+0100) Subject: Get rid of the to_ascii function that was stripping non-ascii characters X-Git-Url: https://projects.mako.cc/source/pyblosxom-markdown2/commitdiff_plain/11c9c6437a3a6bd63a14fec46da1f371d45bc8c1?ds=inline;hp=eda9dfa5fda0ddc342099b8178b259d75f642ac7 Get rid of the to_ascii function that was stripping non-ascii characters from blog posts. --- diff --git a/markdown-plugin.py b/markdown-plugin.py index 6b03ed9..522823d 100644 --- a/markdown-plugin.py +++ b/markdown-plugin.py @@ -70,19 +70,9 @@ def cb_preformat(args): if args['parser'] == PREFORMATTER_ID: return parse(''.join(args['story'])) -def to_ascii(char): - """Return char if char is an ASCII character, '?' otherwise.""" - if ord(char) < 128: - return char - else: - return '?' - def parse(story): - # Replace any non-ascii characters in the story with '?', so that - # python-markdown doesn't crash. - ascii = "".join([to_ascii(x) for x in story]) # Convert the ASCII text to HTML with python-markdown. - html = md.convert(ascii) + html = md.convert(story) # Reset python-markdown ready for next time. md.reset() return html