Opened 9 years ago

Closed 9 years ago

#6577 closed (duplicate)

Python-Markdown 1.7 and Unicode Support

Reported by: Waylan Limberg Owned by: nobody
Component: Contrib apps Version: master
Severity: Keywords: markup markdown
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

With the release of Python-Markdown 1.7, Unicode support for markdown is much stricter. Specifically the docs say:

Note that markdown() expects either a simple ascii string or unicode as input and returns output as unicode. Do not pass
encoded strings to it. If your input is encoded, e.g. as UTF8, it is your responsibility to decode it.

Here's an example using Django's Unicode methods:

s = "öäüß"

print force_unicode(markdown.markdown(smart_str(s)))
MARKDOWN-CRITICAL: "UnicodeDecodeError: Markdown only accepts unicode or ascii  input."
 
print force_unicode(markdown.markdown(smart_unicode(s)))
<p>öäüß</p>

The first try, which produces the error, is what Django currently does. The second is what it probably should do.

Note: This report has been moved from the unrelated ticket #2910 comment 17.

Change History (1)

comment:1 Changed 9 years ago by Waylan Limberg

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: duplicate
Status: newclosed

Sorry, this is a duplicate of #6387.

Note: See TracTickets for help on using tickets.
Back to Top