Description

If you try to export a wiki page into a DocBook document, the export will fail if there is a non-ascii char in a foot note.

Steps to reproduce

The following footnote :

<<FootNote(Le français aime les espaces avec les signe de ponctuation.)>>

will produce the following error :

UnicodeEncodeError: 'ascii' codec can't encode character

Component selection

Patch

The following patch will solve the problem :

diff -r c68058eaa6be MoinMoin/formatter/text_docbook.py
--- a/MoinMoin/formatter/text_docbook.py        Thu Feb 25 16:52:28 2010 +0100
+++ b/MoinMoin/formatter/text_docbook.py        Fri Jun 11 23:51:31 2010 +0200
@@ -605,14 +605,20 @@
 
         elif name == "FootNote":
             footnote = self.doc.createElement('footnote')
-            self._addTextElem(footnote, "para", str(args))
+            self._addTextElem(footnote, "para", unicode(args))
             self.cur.appendChild(footnote)

Discussion

The current patch is probably not the best solution, since this can probably happen in some other part, and the best solution would probably to ensure that any strings coming from user input are unicode.

Plan


CategoryMoinMoinBug

MoinMoin: MoinMoinBugs/DocbookExportFailWithNonAsciiCharAndFootNote (last edited 2010-06-11 22:06:56 by ValentinJaniaut)