]> 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)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:54 +0000 (15:48 +0200)
commit74b9ae71b5cc365a0081bffa4bdd0e4f7e6cf992
tree148610990dc319cf32723642de6f227cceb008c7
parent4f23385a5d295b9913f2db71ed4b7dd003eb1b62
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