[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: Issue with pylupdate7 on Windows
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2021-05-30 11:33:17
Message-ID: 25ef56e7454f058093ddb806a092b62b () riverbankcomputing ! com
[Download RAW message or body]

On 29/05/2021 13:11, Detlev Offenbach wrote:
> Hello Phil,
> 
> pylupdate7 will crash on Windows, if it has to parse a Python source
> file with 'strange' characters. The cause is, that on Windows a
> non-UTF8 codec seems to be used (CP1215 or so). However, most Python
> sources are UTF-8. Therefore line 37 of lupdate/python_source.py
> should read
> 
>         with open(self.filename, encoding="utf-8") as f:
> 
> or you must read the file in binary mode, and analyze the first two
> lines for the existence of a coding line. If found use that coding to
> get a valid text. The default should be utf-8.
> 
> As it is now, the read call in line 38 will fail, if a utf-8 encoded
> character is found.

The next snapshot will handle and embedded coding line.

Phil
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic