polib icon indicating copy to clipboard operation
polib copied to clipboard

Recognised line endings differs for pofile(source) vs. pofile(path)

Open eemeli opened this issue 8 months ago • 0 comments

This code is a bit buggy:

https://github.com/izimobil/polib/blob/bcb2bbab34448ca2e703a364ee523a6241eeff72/polib.py#L1268-L1275

When the pofile argument is a path, the file is opened in text mode, which means that iterating it will result in lines split by universal newlines. When the argument is a source string, it's split into lines with splitlines(), which recognises a wider collection of line endings.

The former is the right thing to do, while the latter will cause errors with messages that contain some of the additional characters.

eemeli avatar Apr 15 '25 08:04 eemeli