mirror of https://github.com/xzeldon/htop.git
simplify UTF-8 detection
This commit is contained in:
parent
016dbbe6a4
commit
1728483aa2
10
CRT.c
10
CRT.c
|
@ -16,6 +16,7 @@ in the source distribution for its full text.
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <langinfo.h>
|
||||||
|
|
||||||
#define ColorPair(i,j) COLOR_PAIR((7-i)*8+j)
|
#define ColorPair(i,j) COLOR_PAIR((7-i)*8+j)
|
||||||
|
|
||||||
|
@ -589,14 +590,7 @@ void CRT_init(int delay, int colorScheme) {
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
#ifdef HAVE_LIBNCURSESW
|
#ifdef HAVE_LIBNCURSESW
|
||||||
char *locale = setlocale(LC_ALL, NULL);
|
if(strcmp(nl_langinfo(CODESET), "UTF-8") == 0)
|
||||||
if (locale == NULL || locale[0] == '\0')
|
|
||||||
locale = setlocale(LC_CTYPE, NULL);
|
|
||||||
if (locale != NULL &&
|
|
||||||
(strstr(locale, "UTF-8") ||
|
|
||||||
strstr(locale, "utf-8") ||
|
|
||||||
strstr(locale, "UTF8") ||
|
|
||||||
strstr(locale, "utf8")))
|
|
||||||
CRT_utf8 = true;
|
CRT_utf8 = true;
|
||||||
else
|
else
|
||||||
CRT_utf8 = false;
|
CRT_utf8 = false;
|
||||||
|
|
Loading…
Reference in New Issue