From dd192a2113d0380d8d1cfa852a34bb921e3e58e0 Mon Sep 17 00:00:00 2001 From: Andrei Gramakov Date: Fri, 17 Jul 2020 13:29:34 +0200 Subject: [PATCH] docs: adds to build_docs.py an encoding check suitable for windows --- docs/build_docs.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/build_docs.py b/docs/build_docs.py index 39e62e68b2..6f75dc4a6e 100755 --- a/docs/build_docs.py +++ b/docs/build_docs.py @@ -69,9 +69,13 @@ def main(): # functions and this way makes Python 2 compatibility really tough if there is any code that assumes text files contain strings (kconfiglib assumes this). # The reason for that is that you need to import io.open() to support the encoding argument on Python 2, and this function always uses Py2's unicode # type not the str type. - if 'UTF-8' not in locale.getlocale(): - raise RuntimeError("build_docs.py requires the default locale's encoding to be UTF-8. " + - "Setting environment variable LC_ALL=C.UTF-8 when running build_docs.py may be enough to fix this.") + if ('UTF-8' not in locale.getlocale()) and ('utf8' not in locale.getlocale()): + raise RuntimeError("build_docs.py requires the default locale's encoding to be UTF-8.\n" + + " - Linux. Setting environment variable LC_ALL=C.UTF-8 when running build_docs.py may be " + + "enough to fix this.\n" + " - Windows. Possible solution for the Windows 10 starting version 1803. Go to " + + "Control Panel->Clock and Region->Region->Administrative->Change system locale...; " + + "Check `Beta: Use Unicode UTF-8 for worldwide language support` and reboot") parser = argparse.ArgumentParser(description='build_docs.py: Build IDF docs', prog='build_docs.py')