diff --git a/main.c b/main.c index 34f72a7c..15ddbb00 100644 --- a/main.c +++ b/main.c @@ -424,10 +424,18 @@ main(int argc, char *const *argv) LOG_ERR("setlocale() failed"); return ret; } + LOG_INFO("locale: %s", locale); - if (!locale_is_utf8()) { - LOG_ERR("locale is not UTF-8"); - return ret; + + bool bad_locale = !locale_is_utf8(); + if (bad_locale) { + LOG_ERR("locale '%s' is not UTF-8", locale); + + if (check_config) + return ret; + + user_notification_add_fmt(&user_notifications, USER_NOTIFICATION_ERROR, + "locale '%s' is not UTF-8", locale); } struct config conf = {NULL}; @@ -502,6 +510,14 @@ main(int argc, char *const *argv) conf.fonts[0].arr[0].pattern, &conf.notifications); } + + if (bad_locale) { + static char *const bad_locale_fake_argv[] = {"/bin/sh", "-c", "", NULL}; + argc = 1; + argv = bad_locale_fake_argv; + conf.hold_at_exit = true; + } + struct fdm *fdm = NULL; struct reaper *reaper = NULL; struct wayland *wayl = NULL;