MoinMoin encoding issue

September 4, 2010

As mentioned in my previous post, the encoding in my MoinMoin wiki was somehow broken. When entering Danish characters on a page, they were turned into garbage (which persisted when switching to edit view). Surprisingly, I fixed this by accident today when making a change to improve the performance of the wiki.

It turns out that the preferred way to run a MoinMoin instance on Apache2 these days is with mod_wsgi. I’m not even sure what that is, except it has to do with running Python code in an Apache server via some daemons.

To install mod_wsgi:

sudo aptitude install libapache2-mod-wsgi

The only change needed in my Apache2 configuration was replacing this line:

ScriptAlias /w "/usr/share/moin/server/moin.cgi"  

with these lines:

WSGIScriptAlias /w /var/www/chopwiki/moin.wsgi

WSGIDaemonProcess chopwiki-daemon user=www-data group=www-data home=/var/www processes=5 threads=10 maximum-requests=1000 umask=0007

WSGIProcessGroup chopwiki-daemon


The “moin.wsgi” referenced above was copied from /usr/share/moin/server into /var/www/chopwiki but not modified. 

After making this change, the character encoding issue was gone as well! I have no idea why, and I’m not going to spend time finding out.