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

Gonzalo Odiard gonzalo at laptop.org
Fri Sep 14 07:31:05 EDT 2012


This patch is not included and haven't received comments.
Any particular reason?
There are ported activities needing this change.

Gonzalo

On Mon, Aug 27, 2012 at 11:09 AM, <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
>
> --
> 1.7.11.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120914/45d960bf/attachment.html>


More information about the Sugar-devel mailing list