[w3m-dev 04109] Re: Bug#276246: w3m's locale parsing should at least see '@euro' modifier
Fumitoshi UKAI <[email protected]>
| Newsgroups | gmane.comp.web.w3m.devel |
|---|---|
| Organization | Debian JP Project |
| Message-ID | <[email protected]> |
@euro nl_langinfo(CODESET)
Index: config.h.in
===================================================================
RCS file: /cvsroot/w3m/w3m/config.h.in,v
retrieving revision 1.14
diff -u -p -r1.14 config.h.in
--- config.h.in 4 Aug 2004 17:32:27 -0000 1.14
+++ config.h.in 13 Oct 2004 16:50:22 -0000
@@ -142,6 +142,7 @@ typedef long clen_t;
#undef HAVE_CHDIR
#undef HAVE_SETPGRP
#undef HAVE_SETLOCALE
+#undef HAVE_LANGINFO_CODESET
#undef SETPGRP_VOID
#ifdef SETPGRP_VOID
Index: configure.in
===================================================================
RCS file: /cvsroot/w3m/w3m/configure.in,v
retrieving revision 1.31
diff -u -p -r1.31 configure.in
--- configure.in 28 Apr 2004 18:19:25 -0000 1.31
+++ configure.in 13 Oct 2004 16:50:26 -0000
@@ -148,6 +148,7 @@ AC_CHECK_FUNCS(strcasecmp strcasestr str
AC_FUNC_STRFTIME
AC_FUNC_WAIT3
AC_FUNC_SETPGRP
+AM_LANGINFO_CODESET
AC_W3M_SYS_ERRLIST
AC_W3M_SIGSETJMP
AC_W3M_SIGNAL
Index: libwc/charset.c
===================================================================
RCS file: /cvsroot/w3m/w3m/libwc/charset.c,v
retrieving revision 1.1
diff -u -p -r1.1 charset.c
--- libwc/charset.c 22 Sep 2003 21:02:23 -0000 1.1
+++ libwc/charset.c 13 Oct 2004 16:50:29 -0000
@@ -6,6 +6,10 @@
#include "wc.h"
+#ifdef HAVE_LANGINFO_CODESET
+#include <langinfo.h>
+#endif
+
wc_locale WcLocale = 0;
static struct {
@@ -369,6 +373,12 @@ wc_locale_to_ces(char *locale)
if (*p == 'C' && *(p+1) == '\0')
return WC_CES_US_ASCII;
+#ifdef HAVE_LANGINFO_CODESET
+ {
+ char *cs = nl_langinfo(CODESET);
+ return wc_charset_to_ces(cs);
+ }
+#endif
for (n = 0; *p && *p != '.' && n < 5; p++) {
if ((unsigned char)*p > 0x20)
buf[n++] = tolower(*p);
--