[PyQt] Inconsistent pylupdate5 behaviour on UTF8 data

Giuseppe Corbelli corbelligiuseppe at mesdan.it
Tue Feb 18 10:57:15 GMT 2020


On 2/18/20 11:37 AM, Giuseppe Corbelli wrote:
> Turns out that there's something in XML re-parsing (or maybe something 
> else that escapes me). Same dataset as my previous email applies.
> 
> This is what happens if you run pylupdate (5.14.1) two times in a row in 
> a windows 10 box:
> 
> (venv_latest) C:\devel\Dynamometer\Supervisor\norms>pylupdate5 -verbose 
> test.pro
> Updating 'locale/it_IT.ts'...
>      Found 2 source texts (2 new and 0 already existing)
> 
> (venv_latest) C:\devel\Dynamometer\Supervisor\norms>pylupdate5 -verbose 
> test.pro
> Updating 'locale/it_IT.ts'...
>      Found 2 source texts (1 new and 1 already existing)
>      Kept 0 obsolete translations
>      Removed 1 obsolete untranslated entry
> 
> The second time the UTF8 entry gets screwed up.
> Everything is fine on Linux, same pylupdate version.
> 
> Digging some more...

Setting CODECFORTR=UTF-8 in .pro works around the issue.
It sets the 'encoding' attribute on '<message>' entities, and non-ascii 
chars are saved as UTF8 instead of XML entities.

I will stop here as it solves my problem. Phil, if you have no strategic 
interest in pursuing this stuff maybe this is worth mentioning in the 
documentation.

Thanks
-- 
Giuseppe Corbelli


More information about the PyQt mailing list