aboutsummaryrefslogtreecommitdiffstats
path: root/libwc
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:21:03 +0000
committerTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:21:03 +0000
commit2d9ece8bcb1c76c3d6990b83b00019e171c759d7 (patch)
treeb29dca9667fe151b2f01262c5907281ad2c7e3e8 /libwc
parentReleasing debian version 0.5.1-4 (diff)
downloadw3m-debian/0.5.1-5.tar.gz
w3m-debian/0.5.1-5.zip
Releasing debian version 0.5.1-5debian/0.5.1-5
Diffstat (limited to '')
-rw-r--r--libwc/Makefile.in2
-rw-r--r--libwc/charset.c10
-rw-r--r--libwc/detect.c2
3 files changed, 12 insertions, 2 deletions
diff --git a/libwc/Makefile.in b/libwc/Makefile.in
index 28a1201..bd99432 100644
--- a/libwc/Makefile.in
+++ b/libwc/Makefile.in
@@ -6,7 +6,7 @@ top_srcdir=@top_srcdir@
VPATH=$(srcdir):.
LIBRARY = libwc.a
CC=@CC@
-CFLAGS = $(OPTS) -I.. -I$(top_srcdir) -I$(srcdir) @CFLAGS@ @WCCFLAGS@ @DEFS@
+CFLAGS = $(OPTS) -I.. -I$(top_srcdir) -I$(srcdir) @CFLAGS@ @CPPFLAGS@ @WCCFLAGS@ @DEFS@
AR=ar
RANLIB=@RANLIB@
RM=rm
diff --git a/libwc/charset.c b/libwc/charset.c
index 95343b3..e64b6f6 100644
--- a/libwc/charset.c
+++ b/libwc/charset.c
@@ -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);
diff --git a/libwc/detect.c b/libwc/detect.c
index eea2d5d..3fdf980 100644
--- a/libwc/detect.c
+++ b/libwc/detect.c
@@ -99,7 +99,7 @@ wc_auto_detect(char *is, size_t len, wc_ces hint)
for (; p < ep && ! WC_DETECT_MAP[*p]; p++)
;
if (p == ep)
- return WC_CES_US_ASCII;
+ return hint;
switch (hint) {
case WC_CES_ISO_2022_JP: