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 <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>

[1] http://lists.sugarlabs.org/archive/sugar-devel/2012-August/038993.html
[2] https://bugzilla.gnome.org/show_bug.cgi?id=681915
This commit is contained in:
Gonzalo Odiard 2012-08-27 11:09:23 -03:00 committed by Simon Schampijer
parent 3a30d3f84e
commit 5fdad9481b

View File

@ -18,6 +18,12 @@
import os import os
import sys 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 import gettext
from optparse import OptionParser from optparse import OptionParser