[Sugar-devel] Unicode strings in translations

Manuel Kaufmann humitos at gmail.com
Wed Aug 15 09:20:11 EDT 2012


On Mon, Aug 13, 2012 at 2:47 PM, S. Daniel Francis
<francis at sugarlabs.org> wrote:
> I don't see why do you need to use unicode in this case, you could
> encode all in utf-8 and forget the conflict.

Here you are another good reason to use Unicode instead any other
encoding. A simple test case:

How many letters has the word: "camión" (Spanish Word)? -> ("truck" in
English) . Let's see what Python says

First, I will try to use the way that I'm proposing because I like
Unicode and because using Unicode is *the way to do it*

>>> len(u"camión")
6

Oh, it's OK. I agree with the result. Now, let's check what Python say
if I use my default encoding (UTF8) for this simple task:

>>> len("camión")
7

So, this is really important to have the correct result here. If we
don't use Unicode we will have bugs all around our code and bugs like
this are difficult to find out.

I propose to make this change (gettext returns Unicode) JUST in the
sugar-toolkit-gtk3 to start doing the things in the right way from now
on. Applying this patch at the sugar-toolkit (gtk2) could convey many
problems with the activities that have already hacked this problem.

See you,

-- 
Kaufmann Manuel
Blog: http://humitos.wordpress.com/
Porfolio: http://fotos.mkaufmann.com.ar/
PyAr: http://www.python.com.ar/


More information about the Sugar-devel mailing list