On Mon, Jun 1, 2009 at 4:02 PM, bfrederi <brfrederi...@gmail.com> wrote:

>
> I'm getting this:
>
> Traceback (most recent call last):
>  File "/home/django-code/aubrey_explore/tests.py", line 18, in
> testSpeaking
>    self.assert_(markdown(self.bla.collection_description_short))
>  File "/usr/lib/python2.5/site-packages/django/contrib/markup/
> templatetags/markup.py", line 72, in markdown
>    return mark_safe(force_unicode(markdown.markdown(smart_str(value),
> extensions, safe_mode=safe_mode)))
>  File "/var/lib/python-support/python2.5/markdown.py", line 1722, in
> markdown
>    return md.convert(text)
>  File "/var/lib/python-support/python2.5/markdown.py", line 1614, in
> convert
>    self.source = removeBOM(self.source, self.encoding)
>  File "/var/lib/python-support/python2.5/markdown.py", line 74, in
> removeBOM
>    if text.startswith(bom):
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 292: ordinal not in range(128)
>
>
Much more useful.  If you Google markdown and removeBOM the top hit will be
this ticket:

http://code.djangoproject.com/ticket/5663#comment:13

That comment, specifically, includes the same exception and traceback as you
are showing. I read subsequent discussion in the ticket to be saying that
the problem here is the markdown version, it's some pre-Unicode support
level that you likely don't want to be using if you need proper Unicode
support.  Apparently some bits may work (that comment shows passing Unicode
working whereas passing a utf-8 encoded bytestring of the same content
fails), but the comments from a markdown core dev indicate any semblance of
"working" here is likely accidental.  Sounds like the easiest fix for you
may be to upgrade your markdown to at least 1.7.

(I'd also get rid of that save() override that is changing the fields to be
utf-8 encoded bytestrings.  It's possibly mostly harmless but introduces a
difference in type for those fields depending on whether you've called
save() on the instance or pulled it from the database, and that could cause
some confusion down the road.)

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to