changeset 10:8959da92eda6

fix crash when gui editing a page with non-ASCII chars imported from: moin--main--1.5--patch-11
author Thomas Waldmann <tw@waldmann-edv.de>
date Fri, 23 Sep 2005 08:37:43 +0000
parents 828548cb3e85
children 0f537d114a39
files MoinMoin/converter/text_html_text_x_moin.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/converter/text_html_text_x_moin.py	Fri Sep 23 07:35:43 2005 +0000
+++ b/MoinMoin/converter/text_html_text_x_moin.py	Fri Sep 23 08:37:43 2005 +0000
@@ -7,6 +7,7 @@
 
 import xml.dom.minidom
 from xml.dom import Node
+from MoinMoin import config
 from MoinMoin import wikiutil
 import MoinMoin.error
 import re, urllib
@@ -835,14 +836,15 @@
 
 
 def parse(text):
-    text = '<?xml version="1.0"?>%s%s' % (dtd, text)
+    text = u'<?xml version="1.0"?>%s%s' % (dtd, text)
+    text = text.encode(config.charset)
     try:
         return xml.dom.minidom.parseString(text)
     except xml.parsers.expat.ExpatError, msg:
         raise MoinMoin.error.ConvertError('ExpatError: %s' % msg)
 
 def convert(request, text):
-    text = "<page>%s</page>" % text
+    text = u"<page>%s</page>" % text
     tree = parse(text)
     strip_whitespace().do(tree)
     strip_break().do(tree)