Description

When the moinmoin editor is opened in text mode, the web server sends the wrong charset in the Content-Type: http header field (Content-Type: text/html; charset=ISO-8859-1). This also applies to the preview mode of the gui editor.

The correct charset would be UTF-8, and if the browser is explicitly told to use UTF-8, everything looks right.

Steps to reproduce

Open some wiki page in the text editor and look at any umlaut contained in that page. Note that the Character Encoding is wrong. Use the LiveHttpHeaders firefox plugin to confirm that the charset is set to ISO-8859-1 in the http header, although the html is UTF-8 encoded.

Example

Component selection

Details

MoinMoin Version

moinmoin-1.9.2

OS and Version

FreeBSD 6.4-RELEASE-p8

Python Version

python-2.6

Server Setup

apache-2.2.16

Server Details

AddDefaultCharset ISO-8859-1

Language you are using the wiki in (set in the browser/UserPreferences)

German

Workaround

The error can be avoided by setting AddDefaultCharset UTF-8 instead of ISO-8859-1 in the apache configuration.

This Patch works also around the issue:

--- PageEditor.py       2010-09-08 22:32:00.000000000 +0200
+++ /usr/local/lib/python2.6/site-packages/MoinMoin/PageEditor.py       2010-09-08 22:30:50.000000000 +0200
@@ -90,6 +90,7 @@
    @keyword uid_override: override user id and name (default None)
    """
     Page.__init__(self, request, page_name, **keywords)
+    request.content_type = "text/html; charset=utf-8"
     self._ = request.getText self.do_revision_backup = keywords.get('do_revision_backup', 1)

/!\ Strange: send_title sets request.content_type and it is called by PageEditor (as well as by Page).

Discussion

Plan


CategoryMoinMoinBug

MoinMoin: MoinMoinBugs/EditorContentTypeHttpHeader (last edited 2010-10-03 19:47:04 by ThomasWaldmann)