add more locale string checks beyond case-sensitive "UTF-8" so that we

can better detect UTF-8 locales, adapted from Debian's UTF-8 patch for
slang


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2392 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
David Lawrence Ramsey 2005-03-18 19:07:25 +00:00
parent 22a3564a2e
commit d456bfa10d
2 changed files with 8 additions and 5 deletions

View File

@ -252,8 +252,10 @@ CVS code -
main() main()
- Try to automatically detect whether UTF-8 support is needed by - Try to automatically detect whether UTF-8 support is needed by
setting the NO_UTF8 flag if setlocale() returns a string that setting the NO_UTF8 flag if setlocale() returns a string that
doesn't contain "UTF-8". When using slang 2.x, enable UTF-8 doesn't contain "UTF8" or "UTF-8", case insensitively. When
support with SLutf8_enable(). (DLR) 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: - nano.h:
- Remove now-unneeded #defines for functions that now have - Remove now-unneeded #defines for functions that now have
multibyte equivalents. (DLR) multibyte equivalents. (DLR)

View File

@ -3963,12 +3963,13 @@ int main(int argc, char **argv)
#ifdef NANO_WIDE #ifdef NANO_WIDE
{ {
/* If the locale set doesn't exist, or it exists but doesn't /* 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 * include the case-insensitive string "UTF8" or "UTF-8", we
* mode. */ * shouldn't go into UTF-8 mode. */
char *locale = setlocale(LC_ALL, ""); char *locale = setlocale(LC_ALL, "");
if (locale == NULL || (locale != NULL && if (locale == NULL || (locale != NULL &&
strstr(locale, "UTF-8") == NULL)) strcasestr(locale, "UTF8") == NULL &&
strcasestr(locale, "UTF-8") == NULL))
SET(NO_UTF8); SET(NO_UTF8);
#ifdef USE_SLANG #ifdef USE_SLANG