Description

MoinMoin show a UnicodeDecode Error page when you request information page from the Main Page. The text output is : "'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)".

Steps to reproduce

Try: http://moinmoin.wikiwikiweb.de/MoinMoinWiki?action=info&hitcounts=1 (german OS, Browser language en)

Details

This Wiki

Workaround

Discussion

Here is a patch for 1.3.5:

Here is a quick fix for 1.5.

   1 * looking for arch@arch.thinkmo.de--2003-archives/moin--main--1.5--patch-123 to compare with
   2 * comparing to arch@arch.thinkmo.de--2003-archives/moin--main--1.5--patch-123
   3 M  MoinMoin/stats/hitcounts.py
   4 
   5 * modified files
   6 
   7 --- orig/MoinMoin/stats/hitcounts.py
   8 +++ mod/MoinMoin/stats/hitcounts.py
   9 @@ -86,8 +86,11 @@
  10      
  11              if event[0] <=  cache_date:
  12                  break
  13 -            # XXX Bug: event[2].get('pagename') -> u'Aktuelle%C4nderungen' 8(
  14 +            
  15 +            # The log returns utf-8 ??!
  16              eventpage = event[2].get('pagename','')
  17 +            eventpage = unicode(eventpage, config.charset)
  18 +            
  19              if filterpage and eventpage != filterpage:
  20                  continue
  21              time_tuple = request.user.getTime(wikiutil.version2timestamp(event[0]))

hitcounts.patch

I'm not sure this is the correct place to fix this. Our internal format is Unicode, so the log should return unicode, not utf-8. It will be very hard to "fix" the log in many places. The log should accept and return only unicode strings or plain ascii. The actual internal format it save the data must be hidden from clients.


wikiutil.makeQueryString() missed want_unicode=True. May be this function behaved nicer in the past.

Plan


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/UnicodeDecodeErrorInInformationPage (last edited 2007-10-29 19:11:35 by localhost)