mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Handle encoding error in layout file parsing more gracefully
Issue a warning about non-decodable files, but do not break
completely.
Addresses #11736
(cherry picked from commit c4da8d38c9
)
This commit is contained in:
parent
0be206c976
commit
457c568dbd
@ -1417,6 +1417,7 @@ def checkLatexConfig(check_config, bool_docbook):
|
||||
classname = file.split(os.sep)[-1].split('.')[0]
|
||||
decline = ""
|
||||
catline = ""
|
||||
try:
|
||||
for line in open(file, 'r', encoding='utf8').readlines():
|
||||
if not empty.match(line) and line[0] != '#'[0]:
|
||||
if decline == "":
|
||||
@ -1437,6 +1438,14 @@ def checkLatexConfig(check_config, bool_docbook):
|
||||
break
|
||||
if nodeclaration:
|
||||
continue
|
||||
except UnicodeDecodeError:
|
||||
logger.warning("**************************************************\n"
|
||||
"Layout file '%s'\n"
|
||||
"cannot be decoded in utf-8.\n"
|
||||
"Please check if the file has the correct encoding.\n"
|
||||
"Skipping this file!\n"
|
||||
"**************************************************" % file)
|
||||
continue
|
||||
testclasses.sort()
|
||||
cl = open('chklayouts.tex', 'w', encoding='utf8')
|
||||
for line in testclasses:
|
||||
|
@ -53,6 +53,7 @@ What's new
|
||||
|
||||
- Correctly strike out deleted text after deleted display math (bug 11716).
|
||||
|
||||
|
||||
* USER INTERFACE
|
||||
|
||||
- Fix backspace deletion of selected items with change tracking (bug 11630).
|
||||
@ -84,11 +85,12 @@ What's new
|
||||
|
||||
|
||||
|
||||
|
||||
* ADVANCED FIND AND REPLACE
|
||||
|
||||
|
||||
|
||||
|
||||
* BUILD/INSTALLATION
|
||||
|
||||
- Do not break configuration if a layout file is not decodable. Rather than that,
|
||||
issue a warning and skip that file (bug 11736).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user