File pykolab-0.7.17-wallace_locale_encoding.patch of Package pykolab

diff -Ppru pykolab-0.7.17.orig/wallace/__init__.py pykolab-0.7.17/wallace/__init__.py
--- pykolab-0.7.17.orig/wallace/__init__.py	2015-10-30 11:34:42.000000000 +0100
+++ pykolab-0.7.17/wallace/__init__.py	2016-01-07 23:49:00.643952302 +0100
@@ -18,8 +18,10 @@
 #
 
 import asyncore
+import codecs
 from distutils import version
 import grp
+import locale
 import multiprocessing
 import os
 import pwd
@@ -104,6 +106,13 @@ class WallaceDaemon(object):
         self.current_connections = 0
         self.max_connections = 24
 
+        # force default encoding to match the locale encoding (T249)
+        reload(sys)
+        sys.setdefaultencoding(locale.getpreferredencoding() or 'utf-8')
+
+        # wrap sys.stdout in a locale-aware StreamWriter (#3983)
+        sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)
+
         daemon_group = conf.add_cli_parser_option_group(_("Daemon Options"))
 
         daemon_group.add_option(
openSUSE Build Service is sponsored by