From 3e8606cc3441465d64b0b1c7ddccb20977680e90 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Wed, 10 Oct 2012 18:05:55 +0000 Subject: 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. The toolkit-gtk3 has already been fixed in 5fdad9481ba7079a6a718159ebe7eb8e5367c46e. Signed-off-by: Simon Schampijer Reviewed-by: Gonzalo Odiard [1] http://lists.sugarlabs.org/archive/sugar-devel/2012-August/038993.html [2] https://bugzilla.gnome.org/show_bug.cgi?id=681915 --- diff --git a/bin/sugar-session b/bin/sugar-session index 42e7beb..7455f38 100755 --- a/bin/sugar-session +++ b/bin/sugar-session @@ -22,6 +22,11 @@ import time import subprocess import shutil +# Change the default encoding to avoid UnicodeDecodeError +# http://lists.sugarlabs.org/archive/sugar-devel/2012-August/038928.html +reload(sys) +sys.setdefaultencoding('utf-8') + if os.environ.get('SUGAR_LOGGER_LEVEL', '') == 'debug': print '%r STARTUP: Starting the shell' % time.time() sys.stdout.flush() -- cgit v0.9.1