Description

I had some strings to display that were mixed strings and unicode strings. in MoinMoin/parser/wiki.py was choking, traceback on line 919 or thereabouts.

I fixed it like this:

[broken workaround]

This may be a clumsy way to fix it. -- Laura Creighton

This is not a bug, and the fix is not needed at all. If you have mixed strings and you want to parse them, you must convert all of them to unicode before you call the parser format()

example:

encoding = 'whatever'
for i, line in enumerate(lines):
    if not instance(line, unicode)
        lines[i] = unicode(line, encoding)

{{{##!irc 20:27:12 < xorAxAx> using which framework/language are the pages generated? do

20:27:30 < xorAxAx> otherwise, he just needs to know that the page data is

20:27:32 < lac> every langauge accepted by the European Union, and Turkish too. 20:27:42 < xorAxAx> programming language :-} 20:27:56 < lac> oh. everything here is in Python. 20:28:20 < xorAxAx> neat. so just advise him to encode() the data before it is

20:28:47 < xorAxAx> anything else (like your workaround) causes other problems

}}}


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/MixedStrUnicodeProblem (last edited 2007-10-29 19:19:43 by localhost)