[LyX/master] Consider file encoding for modules in reconfigure
José Matos
jamatos at lyx.org
Sat Aug 15 16:23:55 UTC 2020
commit a8094051c1ae9c546c76bb0d3300d83e6cdbadef
Author: José Matos <jamatos at lyx.org>
Date: Sat Aug 15 17:49:23 2020 +0100
Consider file encoding for modules in reconfigure
If the modules are not in utf8 then we warn and skip that file
like it happens for layout files.
It would be nice in both cases to have a warn in the gui and not only in the config.log
---
lib/configure.py | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/configure.py b/lib/configure.py
index b638f93..2b4d61f 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -1562,9 +1562,17 @@ def checkModulesConfig():
continue
seen.append(filename)
- retval = processModuleFile(file, filename)
- if retval:
- tx.write(retval)
+ try:
+ retval = processModuleFile(file, filename)
+ if retval:
+ tx.write(retval)
+ except UnicodeDecodeError:
+ logger.warning("**************************************************\n"
+ "Module file '%s'\n"
+ "cannot be decoded in utf-8.\n"
+ "Please check if the file has the correct encoding.\n"
+ "Skipping this file!\n"
+ "**************************************************" % filename)
tx.close()
logger.info('\tdone')
More information about the lyx-cvs
mailing list