Description: Fix Unicode handling
Origin: http://git.gnu.org.ua/cgit/dico.git/commit/?id=efd363456bf8c76110bc08b4d98ec318852cc549
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=591698
diff --git a/app/python/mediawiki.py b/app/python/mediawiki.py
index 7410c8c..e717c0c 100644
--- a/app/python/mediawiki.py
+++ b/app/python/mediawiki.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 #
 # This file is part of GNU Dico.
-# Copyright (C) 2008, 2009 Wojciech Polak
+# Copyright (C) 2008, 2009, 2010 Wojciech Polak
 #
 # GNU Dico is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -24,6 +24,17 @@ from htmlentitydefs import name2codepoint
 from xml.dom import minidom
 from wit import wiki2text
 
+# Set utf-8 as the default encoding. 
+# Trying to do so using encode('utf_8')/unicode, which is 
+# supposed to be the right way, does not work.
+# Simply calling sys.setdefaultencoding is not possible,
+# because, for some obscure reason, Python chooses to delete 
+# this symbol from the namespace after setting its default 
+# encoding in site.py. That's why reload is needed. 
+
+reload(sys)
+sys.setdefaultencoding('utf-8')
+
 try:
     import json
 except ImportError:
@@ -31,7 +42,7 @@ except ImportError:
 
 import dico
 
-__version__ = '1.01'
+__version__ = '1.03'
 
 class DicoModule:
     user_agent = 'Mozilla/1.0'
