bug report: pylupdate corrupts ampersand symbols

Phil Thompson phil at riverbankcomputing.com
Thu Jan 27 15:33:33 GMT 2022


On 25/01/2022 15:06, Efrem Braun wrote:
> Since updating my PyQt5 from version 5.15.4 to PySide6 (and I've 
> confirmed
> that this issue is also present in 5.15.5, so the issue originated 
> there),
> ampersand symbols in the existing .ts files have begun being replaced 
> by
> "&amp", even when the ampersand symbols are being used as escape
> characters. This occurs in the "translation" lines only, not the 
> "source"
> lines. This is an issue when HTML formatting is used.
> 
> For example, I used to have an entry:
> ```
>     <message>
>         <location
> filename="../../xslide-desktop/xslide_desktop/views/Ui_MainWindow.py"
> line="2655"/>
>         
> <source><html><head/><body><p>Background
> File
> <br>
> (optional)</p></body></html></source>
> 
> <translation><html><head/><body><p>バックグラウンドファイル
> <br>
> (任意)</p></body></html></translation>
>     </message>
> ```
> 
> It now gets replaced by:
> 
> ```
>     <message>
>         <location
> filename="../../xslide-desktop/xslide_desktop/views/Ui_MainWindow.py"
> line="2655"/>
>         
> <source><html><head/><body><p>Background
> File
> <br>
> (optional)</p></body></html></source>
>         <translation
> type="obsolete">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;バックグラウンドファイル
> &lt;br&gt;
> (任意)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
>     </message>
> ```
> 
> After converting this to the .qm file and running the application, the
> translation shows up in my application with the html code.
> 
> To workaround this, I'm using pylupdate5 from version 5.15.4 to 
> generate my
> translation files. But obviously it'd be nicer to use the latest 
> version.
> 
> Efrem Braun

I'm struggling to reproduce this. Can you give me the *exact* steps you 
took and attach a short .py source file?

Phil


More information about the PyQt mailing list