From 091867dafbd09ff41fa651043686634d4e24a5d5 Mon Sep 17 00:00:00 2001 From: Iksas Date: Wed, 14 Aug 2024 21:24:53 +0200 Subject: [PATCH] fix crash caused by unsupported locales --- menuconfig.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/menuconfig.py b/menuconfig.py index 7e765d3..4b32d40 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -703,8 +703,13 @@ def menuconfig(kconf): # errors ourselves. kconf.warn = False - # Make curses use the locale settings specified in the environment - locale.setlocale(locale.LC_ALL, "") + + try: + # Make curses use the locale settings specified in the environment + locale.setlocale(locale.LC_ALL, "") + except locale.Error: + # fall back to the default locale + locale.setlocale(locale.LC_ALL, "C") # Try to fix Unicode issues on systems with bad defaults if _CHANGE_C_LC_CTYPE_TO_UTF8: