diff options
author | Christian Hesse <mail@eworm.de> | 2015-07-16 08:12:48 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2015-07-16 08:12:48 +0200 |
commit | 1728483aa280f9f58bca50a7fc26596869770e6a (patch) | |
tree | dccaf6ad37096584c46c3e9ef15a431aca797a25 /CRT.c | |
parent | 016dbbe6a479d186ca618e9d85a56c045e6f788e (diff) |
simplify UTF-8 detection
Diffstat (limited to 'CRT.c')
-rw-r--r-- | CRT.c | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -16,6 +16,7 @@ in the source distribution for its full text. #include <stdlib.h> #include <string.h> #include <locale.h> +#include <langinfo.h> #define ColorPair(i,j) COLOR_PAIR((7-i)*8+j) @@ -589,14 +590,7 @@ void CRT_init(int delay, int colorScheme) { setlocale(LC_ALL, ""); #ifdef HAVE_LIBNCURSESW - char *locale = setlocale(LC_ALL, NULL); - 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"))) + if(strcmp(nl_langinfo(CODESET), "UTF-8") == 0) CRT_utf8 = true; else CRT_utf8 = false; |