Commit c0435b7e authored by kernc's avatar kernc

there was a serious "condition" error in set_utf8_locale(), which prevented...

there was a serious "condition" error in set_utf8_locale(), which prevented "finding" UTF-8 even when it's there, now fixed

git-svn-id: https://logkeys.googlecode.com/svn/trunk@68 c501e62c-e7d1-11de-a198-37193048d1ed
parent 9012b446
......@@ -90,10 +90,12 @@ void set_utf8_locale()
// set locale to common UTF-8 for wchars to be recognized correctly
if(setlocale(LC_CTYPE, "en_US.UTF-8") == NULL) { // if en_US.UTF-8 isn't available
char *locale = setlocale(LC_CTYPE, ""); // try the locale that corresponds to the value of the associated environment variable LC_CTYPE
if (locale == NULL ||
strstr(locale, "UTF-8") == NULL || strstr(locale, "UTF8") == NULL ||
strstr(locale, "utf-8") == NULL || strstr(locale, "utf8") == NULL)
error(EXIT_FAILURE, 0, "LC_CTYPE locale must be of UTF-8 type");
if (locale != NULL &&
(strstr(locale, "UTF-8") != NULL || strstr(locale, "UTF8") != NULL ||
strstr(locale, "utf-8") != NULL || strstr(locale, "utf8") != NULL) )
; // if locale has "UTF-8" in its name, it is cool to do nothing
else
error(EXIT_FAILURE, 0, "LC_CTYPE locale must be of UTF-8 type, or you need en_US.UTF-8 availabe");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment