ftilmann / latexdiff

Compares two latex files and marks up significant differences between them. Releases on www.ctan.org and mirrors
GNU General Public License v3.0
506 stars 72 forks source link

Preamble file encoding undefined #285

Closed Kuszki closed 4 months ago

Kuszki commented 11 months ago

Selecting custom preamble file via --preabmle=file causes the file is open in raw mode thus all non-ascii characters are broken in output file.

Please add support to -e | --encoding so it can set encoding for preamble file or just use locale-default encoding for it.

How to reproduce:

1) Create UTF-8 coded preamble file, then use any non-ascii character in this file 2) Call latexdiff with --preabmle=file 3) Output contains bad characters

https://github.com/ftilmann/latexdiff/blob/1f9d07fd1b6edd914804442de0b396264311df8b/latexdiff#L1879C7-L1879C11

ftilmann commented 4 months ago

Sorry for the delay, I did as you suggested: it will use the encoding, if set explicitly with --encoding option, and the locale encoding otherwise. It will not use the encoding guessed from reading the input latex files, though, as in the current flow the preamble file is read before the encoding is guessed.