Django

Code

Ticket #6577 (closed: duplicate)

Opened 7 months ago

Last modified 7 months ago

Python-Markdown 1.7 and Unicode Support

Reported by: wayla Assigned to: nobody
Milestone: Component: Contrib apps
Version: SVN Keywords: markup markdown
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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.

Attachments

Change History

02/11/08 12:56:01 changed by wayla

  • status changed from new to closed.
  • needs_better_patch changed.
  • resolution set to duplicate.
  • needs_tests changed.
  • needs_docs changed.

Sorry, this is a duplicate of #6387.


Add/Change #6577 (Python-Markdown 1.7 and Unicode Support)




Change Properties
Action