[Sugar-devel] [sugar-toolkit-gtk3] Set default python encoding to utf-8
godiard at sugarlabs.org
godiard at sugarlabs.org
Mon Aug 27 10:09:23 EDT 2012
From: Gonzalo Odiard <godiard at gmail.com>
As spoted by Daniel Narvaez in [1], pygi does not set the default encoding
anymore as the old gtk did. This change break ported activities.
The change in gtk was 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 <gonzalo at laptop.org>
[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 | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/bin/sugar-activity b/bin/sugar-activity
index 5aef1ae..839174a 100644
--- a/bin/sugar-activity
+++ b/bin/sugar-activity
@@ -18,6 +18,11 @@
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
--
1.7.11.2
More information about the Sugar-devel
mailing list