[Sugar-devel] [sugar-toolkit-gtk3] Set default python encoding to utf-8

Simon Schampijer simon at schampijer.de
Wed Sep 26 07:39:01 EDT 2012


Thanks, pushed as: 5fdad9481ba7079a6a718159ebe7eb8e5367c46e

Gonzalo will open a ticket for tracking testing, and one for the Python3 
follow up.

Simon

On 08/27/2012 04:09 PM, godiard at sugarlabs.org wrote:
> 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
>
>



More information about the Sugar-devel mailing list