aboutsummaryrefslogtreecommitdiffstats
path: root/libwc/charset.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:23:02 +0000
committerTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:23:02 +0000
commit6db339b3d7a391f196e7c4b725a4ed0bd00f31cf (patch)
tree7d6fed976b72694d61fc595a745d394e1cd6e1a5 /libwc/charset.c
parentAdding upstream version 0.5.1 (diff)
downloadw3m-6db339b3d7a391f196e7c4b725a4ed0bd00f31cf.tar.gz
w3m-6db339b3d7a391f196e7c4b725a4ed0bd00f31cf.zip
Adding upstream version 0.5.2upstream/0.5.2
Diffstat (limited to '')
-rw-r--r--libwc/charset.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libwc/charset.c b/libwc/charset.c
index 95343b3..d86a129 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,13 @@ 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);
+ if (cs && strcmp(cs, "US-ASCII"))
+ return wc_charset_to_ces(cs);
+ }
+#endif
for (n = 0; *p && *p != '.' && n < 5; p++) {
if ((unsigned char)*p > 0x20)
buf[n++] = tolower(*p);