[Sugar-devel] Unicode strings in translations

Manuel Quiñones manuq at laptop.org
Wed Aug 15 10:10:22 EDT 2012


2012/8/15 Daniel Narvaez <dwnarvaez at gmail.com>:
> I think the reason this worked in gtk2 activities is that importing
> gtk had this side effect (it's in the pango module really)
>
>     /* set the default python encoding to utf-8 */
>     PyUnicode_SetDefaultEncoding("utf-8");
>
> As you can see
>
>>>> u'¡Hola %s!' % 'camión'
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 4: ordinal not in range(128)
>>>> import gtk
>>>> u'¡Hola %s!' % 'camión'
> u'\xa1Hola cami\xf3n!'
>
> Now I don't really like changing default encoding as a side effect but
> the simpler solution is probably to just reinstate that, either in
> pygi or in sugar-toolkit. Then with python 3 hopefully stuff will work
> without this kind of hacks.

Reported bug based on Daniel's findings:

https://bugzilla.gnome.org/show_bug.cgi?id=681915


-- 
.. manuq ..


More information about the Sugar-devel mailing list