[PyQt] string encoding problem with pylupdate4

Phil Thompson phil at riverbankcomputing.com
Mon May 4 16:39:16 BST 2009


On Mon, 04 May 2009 17:31:50 +0200, Tóth Csaba <csaba.toth at davidnet.hu>
wrote:
> Phil Thompson írta:
>> On Mon, 04 May 2009 16:47:18 +0200, Tóth Csaba <csaba.toth at davidnet.hu>
>> wrote:
>>> Phil Thompson írta:
>>>> On Sat, 02 May 2009 04:26:38 +0200, Tóth Csaba
>>>> <csaba.toth at davidnet.hu>
>>>> wrote:
>>>>> hi,
>>>>>
>>>>> i have a problem with the pylupdate4.exe and the encoding it
realises.
>>>>>
>>>>> If i have this code in a py file:
>>>>>
>>>>> #!/usr/bin/env python
>>>>> # -*- coding: utf-8 -*-
>>>>> #
>>>>>
>>>>> a = QtCore.QT_TR_NOOP('Listás hívás összesítő')
>>>>> b = self.trUtf8('Listás hívás összesítő')
>>>>>
>>>>>
>>>>> than i run `pylupdate4.exe file.py -ts tr.ts`
>>>>>
>>>>> than if i open the translate.ts with Linguist i see these two strings
>> to
>>>>> translate (i understand the different context of these strings, the
>>>>> question is with the encodings of them, why differ?)
>>>>>
>>>>> Listás hívás összesítő
>>>>> Listás hívás összesítő
>>>>>
>>>>>
>>>>> attached you can find a .ts file i generated. I use
>>>>> PyQt-Py2.6-gpl-4.4.4-2 with Python 2.6.2.
>>>>>
>>>>> How can i solve this?
>>>> pylupdate4 ignores the coding: utf-8 and so doesn't know that the
>>>> string
>>>> passed to QT_TR_NOOP() is utf8.
>>>>
>>>> I've added support for QT_TR_NOOP_UTF8() which you should use instead.
>>> Thanks :)
>>>
>>> Is this exists in the current available version, or just will be in the
>>> next release?
>> 
>> Next release - there will be a beta installer later today.
> 
> great :)
> because of the changes, i wont use this as whole, but maybe just the
> pylupdate4.
> 
> 
>>> Isn't better if you add support for the python codec definition into
>>> pylupdate4?
>> 
>> Yes, but that will take longer - patches welcome.
> 
> Hmm, i looked, sadly its not python.. its c++..
> Dont you prefer if someone wrote a pythonic version instead of patching
> this?

Yes I would - like pyuic4 so that it can be used as a standalone
application or imported as a module.

Phil


More information about the PyQt mailing list