Creole parser assumes ASCII

Bug #614286 reported by Jeroen T. Vermeulen on 2010-08-06
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Wikkid Wiki
Jeroen T. Vermeulen

Bug Description

The creole parser breaks on non-ASCII characters.

Traceback (most recent call last):
  File "/usr/lib/python2.6/wsgiref/", line 93, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/lib/python2.6/dist-packages/wikkid/user/", line 40, in __call__
    resp = req.get_response(
  File "/usr/lib/pymodules/python2.6/webob/", line 918, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/pymodules/python2.6/webob/", line 886, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.6/dist-packages/wikkid/", line 77, in __call__
    response = view.render(
  File "/usr/local/lib/python2.6/dist-packages/wikkid/view/", line 121, in render
    return self._render(skin)
  File "/usr/local/lib/python2.6/dist-packages/wikkid/view/", line 42, in _render
    return super(WikiPage, self)._render(skin)
  File "/usr/local/lib/python2.6/dist-packages/wikkid/view/", line 111, in _render
    content = template.render(**self.template_args())
  File "/usr/lib/pymodules/python2.6/jinja2/", line 705, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.6/dist-packages/wikkid/skin/default/page.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "/usr/local/lib/python2.6/dist-packages/wikkid/skin/default/base.html", line 43, in top-level template code
    {% block content %}{% endblock %}
  File "/usr/local/lib/python2.6/dist-packages/wikkid/skin/default/page.html", line 3, in block "content"
    {% block content %}{{ view.content }}
  File "/usr/lib/pymodules/python2.6/jinja2/", line 352, in getattr
    return getattr(obj, attribute)
  File "/usr/local/lib/python2.6/dist-packages/wikkid/view/", line 31, in content
    return formatter.format(self.context.base_name, content)
  File "/usr/local/lib/python2.6/dist-packages/wikkid/formatter/", line 33, in format
    return HtmlEmitter(Parser(text, self.rules).parse()).emit()
  File "/usr/local/lib/python2.6/dist-packages/wikkid/contrib/creole_1_1/", line 410, in parse
  File "/usr/local/lib/python2.6/dist-packages/wikkid/contrib/creole_1_1/", line 405, in parse_block
    re.sub(self.rules.block_re, self._replace, raw)
  File "/usr/lib/python2.6/", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
  File "/usr/local/lib/python2.6/dist-packages/wikkid/contrib/creole_1_1/", line 394, in _replace
  File "/usr/local/lib/python2.6/dist-packages/wikkid/contrib/creole_1_1/", line 305, in _text_repl
  File "/usr/local/lib/python2.6/dist-packages/wikkid/contrib/creole_1_1/", line 400, in parse_inline
    re.sub(self.rules.inline_re, self._replace, raw)
  File "/usr/lib/python2.6/", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
  File "/usr/local/lib/python2.6/dist-packages/wikkid/contrib/creole_1_1/", line 394, in _replace
  File "/usr/local/lib/python2.6/dist-packages/wikkid/contrib/creole_1_1/", line 385, in _char_repl
    self.text.content += groups.get('char', u'')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

Related branches

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Attaching a branch that seems to make it work for me, on cursory inspection. It's probably all wrong etc. so not bothering to write tests. Just an illustration.

Revision history for this message
Tim Penhey (thumper) wrote :

I'll take something that appears to work over nothing at all. We can write more tests as we go :)

Changed in wikkid:
status: New → Fix Committed
milestone: none → 0.2
assignee: nobody → Jeroen T. Vermeulen (jtv)
status: Fix Committed → In Progress
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers