]> git.lyx.org Git - lyx.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>
Sat, 14 Mar 2020 16:19:08 +0000 (17:19 +0100)
commitbd6d09fc98b4bae208499008446d4bb7738111e2
treed6ca1fc27fe1a4a22a290a18f43a1f651fff9f92
parente48e04e889e16438149c8150bb2541f54afd9ec5
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.
lib/scripts/legacy_lyxpreview2ppm.py
lib/scripts/lyxpreview_tools.py