From a8094051c1ae9c546c76bb0d3300d83e6cdbadef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Matos?= Date: Sat, 15 Aug 2020 17:49:23 +0100 Subject: [PATCH] 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 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/configure.py b/lib/configure.py index b638f93813..2b4d61f597 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') -- 2.39.5