gnue-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GNUe-dev] unicode error


From: Reinhard Müller
Subject: Re: [GNUe-dev] unicode error
Date: Tue, 01 Jun 2004 10:42:58 +0200

Am Die, den 01.06.2004 schrieb address@hidden um 0:20:
> > _("foo %s") % value
> > 
> > breaks, if "value" is of unicode type and contains non-ascii characters.
> 
> ? I thought that was if translated "foo ..." contains non-ascii chars.

Yes, you're right.

Generally, if in the expression "x % y" one of the values is StringType
and the other is UnicodeType, Python implicitly tries to convert the
StringType to UnicodeType. This breaks if the StringType contains
non-ASCII characters, because Python doesn't know which encoding these
non-ASCII characters are in.

> If this is solid, and the problem includes the translation in addition
> to the value, I wonder if I could help. I've 'grepped' gnue-common
> sources and found a good number of occurrences, but I wonder if anyone
> can do the job of receiving my sources, validating them and updating,
> and if this job isn't more time expensive than doing the changes.

The problem that you would have to know which variables hold StringType
values, and which variables hold UnicodeType values, to fix it properly.

_("foo %s") % bar  -> breaks if "bar" is UnicodeType
u_("foo %s") % bar -> breaks if "bar" is StringType containing non-ASCII

The only way of really properly fixing it is to go through *all* of the
code and change everything to use Unicode.

We already did this for appserver and for parts of common. But you need
knowledge of the underlying code to do that. So it will depend on the
forms/reports/etc. developers when this stuff will be fixed.

Meanwhile, we can't do much but fix those occurances of problems we
accidentally find.

Thanks,
-- 
Reinhard Müller                 Tel +43 (5577) 89877-0
BYTEWISE Software GmbH          Fax +43 (5577) 89877-66
A-6890 Lustenau, Enga 2         http://www.bytewise.at
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]