diff --git a/ChangeLog b/ChangeLog index 8e4da46aa5b84d91ff79083a03b3d0f83eb0f77f..f088b1c55be18bb28ac2198e242c52d6e3f60b6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -252,8 +252,10 @@ CVS code - main() - Try to automatically detect whether UTF-8 support is needed by setting the NO_UTF8 flag if setlocale() returns a string that - doesn't contain "UTF-8". When using slang 2.x, enable UTF-8 - support with SLutf8_enable(). (DLR) + doesn't contain "UTF8" or "UTF-8", case insensitively. When + using slang 2.x, enable UTF-8 support with SLutf8_enable(). + (DLR, string checks beyond case-sensitive "UTF-8" adapted from + Debian's UTF-8 patch for slang) - nano.h: - Remove now-unneeded #defines for functions that now have multibyte equivalents. (DLR) diff --git a/src/nano.c b/src/nano.c index 2f843c1537a78e9999ee2a76a0bf088673efb64c..a9ce1540679fb35d372af02680ddc0cc61641cc9 100644 --- a/src/nano.c +++ b/src/nano.c @@ -3963,12 +3963,13 @@ int main(int argc, char **argv) #ifdef NANO_WIDE { /* If the locale set doesn't exist, or it exists but doesn't - * include the string "UTF-8", we shouldn't go into UTF-8 - * mode. */ + * include the case-insensitive string "UTF8" or "UTF-8", we + * shouldn't go into UTF-8 mode. */ char *locale = setlocale(LC_ALL, ""); if (locale == NULL || (locale != NULL && - strstr(locale, "UTF-8") == NULL)) + strcasestr(locale, "UTF8") == NULL && + strcasestr(locale, "UTF-8") == NULL)) SET(NO_UTF8); #ifdef USE_SLANG