Description
When macro names contain non-ASCII char MoinMoin will crash. e.g. <<über>>.
Such macro names almost always result from typos or unfamiliarity with wiki syntax, but shouldn't cause Moin to crash.
Steps to reproduce
Write <<über>> in a page.
- Save.
- Get a 500 error.
Example
Component selection
- general
Details
MoinMoin Version |
MoinMoin 1.9.7 |
OS and Version |
CentOS 6.2 |
Python Version |
2.7.5 |
Server Setup |
uwsgi |
Server Details |
|
Language you are using the wiki in (set in the browser/UserPreferences) |
English |
Workaround
Edit the page by appending action=edit
- Fix the macro that is causing the trouble.
Discussion
Interesting, thanks for finding that. Are you working on a fix?
I've found the guilty party:
File "bug", line 11, in <module> File "/home/xiaq/src/moin1/MoinMoin/formatter/__init__.py", line 310, in macro return macro_obj.execute(name, args) File "/home/xiaq/src/moin1/MoinMoin/macro/__init__.py", line 113, in execute call = getattr(self, 'macro_%s' % macro_name) UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 6: ordinal not in range(128)
Evidently one should 1) test whether macro_name is convertible to str before doing 'macro_%s' % macro_name, in case of UnicodeEncodeError 2) terminate macro expansion and output an error instead. But I'm not sure how to do 2).
OK, I know how to do 2) :). I'll follow how the except Exception does a bit later in the execute body.
CR: http://codereview.appspot.com/35360044
Plan
- Priority:
- Assigned to:
Status: fixed by http://hg.moinmo.in/moin/1.9/rev/2061aa0dff6d