diff options
Diffstat (limited to '')
-rw-r--r-- | libwc/Makefile.in | 2 | ||||
-rw-r--r-- | libwc/charset.c | 11 | ||||
-rw-r--r-- | libwc/detect.c | 2 | ||||
-rw-r--r-- | libwc/map/ucs_wide.map | 11 | ||||
-rw-r--r-- | libwc/ucs.c | 3 | ||||
-rw-r--r-- | libwc/ucs.h | 1 |
6 files changed, 22 insertions, 8 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..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); 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: diff --git a/libwc/map/ucs_wide.map b/libwc/map/ucs_wide.map index 714e4c5..9d79f54 100644 --- a/libwc/map/ucs_wide.map +++ b/libwc/map/ucs_wide.map @@ -1,14 +1,15 @@ -#define N_ucs_wide_map 10 +#define N_ucs_wide_map 11 static wc_map ucs_wide_map[ N_ucs_wide_map ] = { { 0x1100, 0x115F }, - { 0x2E80, 0x3009 }, - { 0x300C, 0x3019 }, - { 0x301C, 0x303E }, - { 0x3040, 0xA4CF }, + { 0x2329, 0x232A }, + { 0x2E80, 0x303E }, + { 0x3040, 0x4DBF }, + { 0x4E00, 0xA4CF }, { 0xAC00, 0xD7A3 }, { 0xF900, 0xFAFF }, + { 0xFE10, 0xFE19 }, { 0xFE30, 0xFE6F }, { 0xFF00, 0xFF5F }, { 0xFFE0, 0xFFE6 }, diff --git a/libwc/ucs.c b/libwc/ucs.c index b9dfec3..2534b5a 100644 --- a/libwc/ucs.c +++ b/libwc/ucs.c @@ -522,7 +522,8 @@ wc_is_ucs_wide(wc_uint32 ucs) return (wc_map_range_search((wc_uint16)ucs, ucs_wide_map, N_ucs_wide_map) != NULL); else - return ((ucs & ~0xFFFF) == WC_C_UCS4_PLANE2); + return ((ucs & ~0xFFFF) == WC_C_UCS4_PLANE2 || + (ucs & ~0xFFFF) == WC_C_UCS4_PLANE3); } wc_bool diff --git a/libwc/ucs.h b/libwc/ucs.h index 21c7070..5003bac 100644 --- a/libwc/ucs.h +++ b/libwc/ucs.h @@ -22,6 +22,7 @@ #define WC_C_CANCEL_TAG 0xE007F #define WC_C_UCS4_PLANE1 0x10000 #define WC_C_UCS4_PLANE2 0x20000 +#define WC_C_UCS4_PLANE3 0x30000 #define wc_ucs_tag_to_ucs(c) ((c) & WC_C_UNICODE_MASK) #define wc_ucs_tag_to_tag(c) ((c) >> 24) |