]> git.lyx.org Git - features.git/commit
Fix Python 3 issues when generating preview snippets
authorEnrico Forestieri <forenr@lyx.org>
Sat, 14 Mar 2020 16:03:16 +0000 (17:03 +0100)
committerEnrico Forestieri <forenr@lyx.org>
Mon, 18 May 2020 18:44:33 +0000 (20:44 +0200)
commit51b8778c73f111772d178192bf41bb0bf0550d31
tree6e2694275156a18186f07852dd85a290529139a2
parent36bb71c4c5280e38d2bdd13cd260c84615373893
Fix Python 3 issues when generating preview snippets

The log file generated by latex can contain strings encoded in
whatever supported encoding. Instead of guessing the encoding,
it is better to open it in binary mode and then performing the
necessary comparisons as "bytes". In order to do this, the
strings are encoded in utf8, so that, for example, b"pythön" is
encoded as "pyth\xc3\xb6n" (7 bytes). Of course, this means that
we can only successfully perform comparisons with ascii strings.
However, this is what we actually do, as we only search for
ascii strings in the log file.

(cherry picked from commit bd6d09fc98b4bae208499008446d4bb7738111e2)
lib/scripts/legacy_lyxpreview2ppm.py
lib/scripts/lyxpreview_tools.py