From 5fdad9481ba7079a6a718159ebe7eb8e5367c46e Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Mon, 27 Aug 2012 11:09:23 -0300 Subject: [PATCH] Set default python encoding to utf-8 As spoted by Daniel Narvaez in [1], pygi does not set the default encoding anymore as the old GTK+ did. This change does break activities ported to GTK+3. The change in GTK+ has been discussed upstream here [2]. A better solution will be implemented when we port to Python 3, when we will be able to use real unicode strings. Signed-off-by: Gonzalo Odiard Acked-by: Simon Schampijer [1] http://lists.sugarlabs.org/archive/sugar-devel/2012-August/038993.html [2] https://bugzilla.gnome.org/show_bug.cgi?id=681915 --- bin/sugar-activity | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/sugar-activity b/bin/sugar-activity index 5aef1ae5..abaa091b 100644 --- a/bin/sugar-activity +++ b/bin/sugar-activity @@ -18,6 +18,12 @@ import os import sys + +# Change the default encoding to avoid UnicodeDecodeError +# http://lists.sugarlabs.org/archive/sugar-devel/2012-August/038928.html +reload(sys) +sys.setdefaultencoding('utf-8') + import gettext from optparse import OptionParser