add option (-U, --no-unicode) to disable unicode at runtime

This commit is contained in:
Christian Hesse
2020-09-01 10:09:00 +02:00
parent f5b3e8d2a3
commit db5adbeae0
4 changed files with 27 additions and 15 deletions

6
CRT.c
View File

@ -667,7 +667,7 @@ void CRT_restorePrivileges() {
// TODO: pass an instance of Settings instead.
void CRT_init(int delay, int colorScheme) {
void CRT_init(int delay, int colorScheme, bool allowUnicode) {
initscr();
noecho();
CRT_delay = delay;
@ -733,10 +733,12 @@ void CRT_init(int delay, int colorScheme) {
setlocale(LC_CTYPE, "");
#ifdef HAVE_LIBNCURSESW
if(strcmp(nl_langinfo(CODESET), "UTF-8") == 0)
if (allowUnicode && strcmp(nl_langinfo(CODESET), "UTF-8") == 0)
CRT_utf8 = true;
else
CRT_utf8 = false;
#else
(void) allowUnicode;
#endif
CRT_treeStr =