+2007-05-25 David Lawrence Ramsey <pooka109@gmail.com>
+
+ * configure.ac, nano.c (main): Replace the current hackish check
+ for a UTF-8 locale with a proper call to nl_langinfo().
+
2007-05-22 David Lawrence Ramsey <pooka109@gmail.com>
* browser.c (do_browser), nano.c (do_mouse), prompt.c
AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
if test x$enable_utf8 != xno; then
- AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace mblen mbstowcs mbtowc wctomb wcwidth)
+ AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen mbstowcs mbtowc wctomb wcwidth)
fi
if test x$ac_cv_func_vsnprintf = xno; then
test x$ac_cv_func_iswalnum = xyes && \
test x$ac_cv_func_iswpunct = xyes && \
(test x$ac_cv_func_iswblank = xyes || test x$ac_cv_func_iswspace = xyes) && \
+ test x$ac_cv_func_nl_langinfo = xyes && \
test x$ac_cv_func_mblen = xyes && \
test x$ac_cv_func_mbstowcs = xyes && \
test x$ac_cv_func_mbtowc = xyes && \
test x$ac_cv_func_wctomb = xyes && \
test x$ac_cv_func_wcwidth = xyes; then
- AC_DEFINE(ENABLE_UTF8, 1, [Define this if your system has sufficient UTF-8 support (a wide curses library, iswalnum(), iswpunct(), iswblank() or iswspace(), mblen(), mbstowcs(), mbtowc(), wctomb(), and wcwidth()).])
+ AC_DEFINE(ENABLE_UTF8, 1, [Define this if your system has sufficient UTF-8 support (a wide curses library, iswalnum(), iswpunct(), iswblank() or iswspace(), nl_langinfo, mblen(), mbstowcs(), mbtowc(), wctomb(), and wcwidth()).])
else
if test x$enable_utf8 = xyes; then
AC_MSG_ERROR([
#include <errno.h>
#include <ctype.h>
#include <locale.h>
+#include <langinfo.h>
#include <termios.h>
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#ifdef ENABLE_UTF8
{
- /* If the locale set exists and includes the case-insensitive
- * string "UTF8" or "UTF-8", we should use UTF-8. */
+ /* If the locale set exists and uses UTF-8, we should use
+ * UTF-8. */
char *locale = setlocale(LC_ALL, "");
- if (locale != NULL && (strcasestr(locale, "UTF8") != NULL ||
- strcasestr(locale, "UTF-8") != NULL)) {
+ if (locale != NULL && (strcmp(nl_langinfo(CODESET),
+ "UTF-8") == 0)) {
#ifdef USE_SLANG
SLutf8_enable(1);
#endif