** E-Mail: furukawa@tcp-ip.or.jp
** \e$B$^$G8fO"Mm$r$*4j$$$7$^$9!#\e(B
***********************************************************************/
-/* $Id: nkf.c,v 1.90 2006/01/23 18:48:14 naruse Exp $ */
+/* $Id: nkf.c,v 1.91 2006/03/04 17:07:59 naruse Exp $ */
#define NKF_VERSION "2.0.5"
-#define NKF_RELEASE_DATE "2006-01-24"
+#define NKF_RELEASE_DATE "2006-03-04"
#include "config.h"
#define COPY_RIGHT \
#if defined(UTF8_OUTPUT_ENABLE) || defined(UTF8_INPUT_ENABLE)
-#define sizeof_euc_utf8 94
#define sizeof_euc_to_utf8_1byte 94
#define sizeof_euc_to_utf8_2bytes 94
#define sizeof_utf8_to_euc_C2 64
STATIC int s2e_conv PROTO((int c2, int c1, int *p2, int *p1));
STATIC int e_iconv PROTO((int c2,int c1,int c0));
#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
-/* Microsoft UCS Mapping Compatible
+/* UCS Mapping
* 0: Shift_JIS, eucJP-ascii
* 1: eucJP-ms
* 2: CP932, CP51932
*/
-#define EUCJPMS 1
-#define MS_CODEPAGE 2
-STATIC int ms_ucs_map_f = 0;
+#define UCS_MAP_ASCII 0
+#define UCS_MAP_MS 1
+#define UCS_MAP_CP932 2
+STATIC int ms_ucs_map_f = UCS_MAP_ASCII;
#endif
#ifdef UTF8_INPUT_ENABLE
-/* don't convert characters when the mapping is not defined in the standard */
-STATIC int strict_mapping_f = TRUE;
-/* disable NEC special, NEC-selected IBM extended and IBM extended characters */
-STATIC int disable_cp932ext_f = FALSE;
+/* no NEC special, NEC-selected IBM extended and IBM extended characters */
+STATIC int no_cp932ext_f = FALSE;
/* ignore ZERO WIDTH NO-BREAK SPACE */
STATIC int ignore_zwnbsp_f = TRUE;
-/* don't convert characters that can't secure round trip convertion */
-STATIC int unicode_round_trip_f = FALSE;
+STATIC int no_best_fit_chars_f = FALSE;
STATIC int unicode_subchar = '?'; /* the regular substitution character */
STATIC void encode_fallback_html PROTO((int c));
STATIC void encode_fallback_xml PROTO((int c));
#endif
#ifdef SHIFTJIS_CP932
-/* invert IBM extended characters to others
- and controls some UCS mapping for Microsoft Code Page */
+/* invert IBM extended characters to others */
STATIC int cp51932_f = TRUE;
#define CP932_TABLE_BEGIN (0xfa)
#define CP932_TABLE_END (0xfc)
#ifdef UTF8_INPUT_ENABLE
{"utf8-input", "W"},
{"utf16-input", "W16"},
- {"disable-cp932ext", ""},
- {"strict-mapping", ""},
- {"enable-round-trip",""},
+ {"no-cp932ext", ""},
+ {"no-best-fit-chars",""},
#endif
#ifdef UNICODE_NORMALIZATION
{"utf8mac-input", ""},
}else if(strcmp(codeset, "SHIFT_JIS") == 0){
input_f = SJIS_INPUT;
if (x0201_f==NO_X0201) x0201_f=TRUE;
- }else if(strcmp(codeset, "CP932") == 0){
+ }else if(strcmp(codeset, "WINDOWS-31J") == 0 ||
+ strcmp(codeset, "CSWINDOWS31J") == 0 ||
+ strcmp(codeset, "CP932") == 0 ||
+ strcmp(codeset, "MS932") == 0){
input_f = SJIS_INPUT;
x0201_f = FALSE;
#ifdef SHIFTJIS_CP932
cp51932_f = TRUE;
- cp932inv_f = TRUE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = 2;
+ ms_ucs_map_f = UCS_MAP_CP932;
#endif
}else if(strcmp(codeset, "EUCJP") == 0 ||
strcmp(codeset, "EUC-JP") == 0){
x0201_f = FALSE;
#ifdef SHIFTJIS_CP932
cp51932_f = TRUE;
- cp932inv_f = TRUE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = 2;
+ ms_ucs_map_f = UCS_MAP_CP932;
#endif
}else if(strcmp(codeset, "EUC-JP-MS") == 0 ||
- strcmp(codeset, "EUCJP-MS") == 0){
+ strcmp(codeset, "EUCJP-MS") == 0 ||
+ strcmp(codeset, "EUCJPMS") == 0){
input_f = JIS_INPUT;
x0201_f = FALSE;
#ifdef SHIFTJIS_CP932
cp51932_f = FALSE;
- cp932inv_f = TRUE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = 1;
+ ms_ucs_map_f = UCS_MAP_MS;
#endif
}else if(strcmp(codeset, "EUC-JP-ASCII") == 0 ||
strcmp(codeset, "EUCJP-ASCII") == 0){
x0201_f = FALSE;
#ifdef SHIFTJIS_CP932
cp51932_f = FALSE;
- cp932inv_f = TRUE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = 0;
+ ms_ucs_map_f = UCS_MAP_ASCII;
#endif
}else if(strcmp(codeset, "SHIFT_JISX0213") == 0){
input_f = SJIS_INPUT;
output_conv = j_oconv;
}else if(strcmp(codeset, "SHIFT_JIS") == 0){
output_conv = s_oconv;
- }else if(strcmp(codeset, "CP932") == 0){
+ }else if(strcmp(codeset, "WINDOWS-31J") == 0 ||
+ strcmp(codeset, "CSWINDOWS31J") == 0 ||
+ strcmp(codeset, "CP932") == 0 ||
+ strcmp(codeset, "MS932") == 0){
output_conv = s_oconv;
x0201_f = FALSE;
#ifdef SHIFTJIS_CP932
- cp51932_f = TRUE;
- cp932inv_f = TRUE;
+ cp51932_f = TRUE;
+ cp932inv_f = TRUE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = 2;
+ ms_ucs_map_f = UCS_MAP_CP932;
#endif
}else if(strcmp(codeset, "EUCJP") == 0 ||
strcmp(codeset, "EUC-JP") == 0){
output_conv = e_oconv;
x0201_f = FALSE;
#ifdef SHIFTJIS_CP932
- cp51932_f = TRUE;
- cp932inv_f = TRUE;
+ cp51932_f = TRUE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = 2;
+ ms_ucs_map_f = UCS_MAP_CP932;
#endif
}else if(strcmp(codeset, "EUC-JP-MS") == 0 ||
- strcmp(codeset, "EUCJP-MS") == 0){
+ strcmp(codeset, "EUCJP-MS") == 0 ||
+ strcmp(codeset, "EUCJPMS") == 0){
output_conv = e_oconv;
x0201_f = FALSE;
#ifdef X0212_ENABLE
x0212_f = TRUE;
#endif
#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
+ cp51932_f = FALSE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = 1;
+ ms_ucs_map_f = UCS_MAP_MS;
#endif
}else if(strcmp(codeset, "EUC-JP-ASCII") == 0 ||
strcmp(codeset, "EUCJP-ASCII") == 0){
x0212_f = TRUE;
#endif
#ifdef SHIFTJIS_CP932
- cp51932_f = FALSE;
+ cp51932_f = FALSE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = 0;
+ ms_ucs_map_f = UCS_MAP_ASCII;
#endif
}else if(strcmp(codeset, "SHIFT_JISX0213") == 0){
output_conv = s_oconv;
x0213_f = TRUE;
+#ifdef SHIFTJIS_CP932
+ cp932inv_f = FALSE;
+#endif
}else if(strcmp(codeset, "EUC-JISX0213") == 0){
output_conv = e_oconv;
#ifdef X0212_ENABLE
x0212_f = TRUE;
#endif
x0213_f = TRUE;
+#ifdef SHIFTJIS_CP932
+ cp51932_f = FALSE;
+#endif
#ifdef UTF8_OUTPUT_ENABLE
}else if(strcmp(codeset, "UTF-8") == 0){
output_conv = w_oconv;
cp932inv_f = TRUE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = 2;
+ ms_ucs_map_f = UCS_MAP_CP932;
#endif
continue;
}
cp932inv_f = FALSE;
#endif
#ifdef UTF8_OUTPUT_ENABLE
- ms_ucs_map_f = 0;
+ ms_ucs_map_f = UCS_MAP_ASCII;
#endif
continue;
}
internal_unicode_f = TRUE;
continue;
}
- if (strcmp(long_option[i].name, "disable-cp932ext") == 0){
- disable_cp932ext_f = TRUE;
+ if (strcmp(long_option[i].name, "no-cp932ext") == 0){
+ no_cp932ext_f = TRUE;
continue;
}
- if (strcmp(long_option[i].name, "enable-round-trip") == 0){
- unicode_round_trip_f = TRUE;
+ if (strcmp(long_option[i].name, "no-best-fit-chars") == 0){
+ no_best_fit_chars_f = TRUE;
continue;
}
if (strcmp(long_option[i].name, "fb-skip") == 0){
#endif
#ifdef UTF8_OUTPUT_ENABLE
if (strcmp(long_option[i].name, "ms-ucs-map") == 0){
- ms_ucs_map_f = 1;
+ ms_ucs_map_f = UCS_MAP_MS;
continue;
}
#endif
if(input_f == SJIS_INPUT
#ifdef UTF8_INPUT_ENABLE
- || input_f == UTF8_INPUT || input_f == UTF16BE_INPUT
+ || input_f == UTF8_INPUT || input_f == UTF16BE_INPUT || input_f == UTF16LE_INPUT
#endif
){
is_8bit = TRUE;
#define LAST break /* end of loop, go closing */
while ((c1 = (*i_getc)(f)) != EOF) {
- code_status(c1);
+#ifdef INPUT_CODE_FIX
+ if (!input_f)
+#endif
+ code_status(c1);
if (c2) {
/* second byte */
if (c2 > DEL) {
*p2 = 0;
*p1 = val;
}else{
- if(!ms_ucs_map_f){
- /* eucJP-ascii */
- switch(val){
- case 0x203E:
- *p2 = 0x21;
- *p1 = 0x31;
- return ret;
- break;
- case 0xFF5E:
- *p2 = 0x8F22;
- *p1 = 0x37;
- return ret;
- break;
- }
- }
w16w_conv(val, &c2, &c1, &c0);
ret = unicode_to_jis_common(c2, c1, c0, p2, p1);
#ifdef NUMCHAR_OPTION
int *p2, *p1;
{
extern const unsigned short *const utf8_to_euc_2bytes[];
+ extern const unsigned short *const utf8_to_euc_2bytes_ms[];
+ extern const unsigned short *const utf8_to_euc_2bytes_932[];
extern const unsigned short *const *const utf8_to_euc_3bytes[];
+ extern const unsigned short *const *const utf8_to_euc_3bytes_ms[];
+ extern const unsigned short *const *const utf8_to_euc_3bytes_932[];
+ const unsigned short *const *pp;
+ const unsigned short *const *const *ppp;
+ STATIC const int no_best_fit_chars_table_C2[] =
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0,
+ 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0};
+ STATIC const int no_best_fit_chars_table_932_C2[] =
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0};
+ STATIC const int no_best_fit_chars_table_932_C3[] =
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1};
int ret = 0;
- if(c2 < 0xe0){
- if (ms_ucs_map_f == 2){
- /* CP932/CP51932: U+00A6 (BROKEN BAR) -> not 0x8fa2c3, but 0x7c */
- if(c2 == 0xC2){
- switch(c1){
- case 0xA5:
- if (p2) *p2 = 0;
- if (p1) *p1 = 0x5C;
- return 0;
- case 0xA6:
- if (p2) *p2 = 0;
- if (p1) *p1 = 0x7C;
- return 0;
- }
- }
- }else if(strict_mapping_f){
- switch(c2){
- case 0xC2:
- switch(c1){
- case 0xAB: case 0xAD: case 0xB2: case 0xB3:
- case 0xB5: case 0xB7: case 0xB9: case 0xBB:
- return 1;
- }
- break;
- case 0xC3:
- switch(c1){
- case 0x90:
- return 1;
- }
- break;
- }
- }
- ret = w_iconv_common(c2, c1, utf8_to_euc_2bytes, sizeof_utf8_to_euc_2bytes, p2, p1);
- if(!ret && !ms_ucs_map_f
-#ifdef X0212_ENABLE
- && !x0212_f
-#endif
- ){
- if(*p2 == 0 && *p1 < 0x80){
- return 1;
- }else if(*p2 > 0xFF){
- int s2, s1;
- if (e2s_conv(*p2, *p1, &s2, &s1) == 0){
- s2e_conv(s2, s1, p2, p1);
- if(*p2 == 0 && *p1 < 0x80)
- return 1;
- }else return 1;
- }
- }
- }else if(c0){
- if(unicode_round_trip_f){
- switch(c2){
- case 0xE2:
- switch(c1){
- case 0x80:
- if(c0 == 0x95) return 1;
- break;
- case 0x88:
- if(c0 == 0xA5) return 1;
- break;
- }
- break;
- case 0xEF:
- switch(c1){
- case 0xBB:
- if(c0 == 0xBF) return 1;
- break;
- case 0xBC:
- if(c0 == 0x8D) return 1;
+ if(c2 < 0x80){
+ *p2 = 0;
+ *p1 = c2;
+ }else if(c2 < 0xe0){
+ if(no_best_fit_chars_f){
+ if(ms_ucs_map_f == UCS_MAP_CP932){
+ switch(c2){
+ case 0xC2:
+ if(no_best_fit_chars_table_932_C2[c1&0x3F]) return 1;
break;
- case 0xBF:
- if(0xA0 <= c0 && c0 <= 0xA5) return 1;
+ case 0xC3:
+ if(no_best_fit_chars_table_932_C3[c1&0x3F]) return 1;
break;
}
- break;
- }
- }
- if(!ms_ucs_map_f){
- /* eucJP-ascii */
- if(c2 == 0xE2 && c1 == 0x80 && c0 == 0xBE){
- if (p2) *p2 = 0x21;
- if (p1) *p1 = 0x31;
- return ret;
- }else if(c2 == 0xEF && c1 == 0xBD && c0 == 0x9E){
- if (p2) *p2 = 0x8F22;
- if (p1) *p1 = 0x37;
- return ret;
+ }else{
+ if(c2 == 0xC2 && no_best_fit_chars_table_C2[c1&0x3F]) return 1;
}
}
- if(!strict_mapping_f);
- else if(ms_ucs_map_f == 2){
- /* Microsoft Code Page */
- switch(c2){
- case 0xE2:
- switch(c1){
- case 0x80:
- switch(c0){
- case 0x94: case 0x96: case 0xBE:
- return 1;
+ pp =
+ ms_ucs_map_f == UCS_MAP_CP932 ? utf8_to_euc_2bytes_932 :
+ ms_ucs_map_f == UCS_MAP_MS ? utf8_to_euc_2bytes_ms :
+ utf8_to_euc_2bytes;
+ ret = w_iconv_common(c2, c1, pp, sizeof_utf8_to_euc_2bytes, p2, p1);
+ }else if(c0){
+ if(no_best_fit_chars_f){
+ if(ms_ucs_map_f == UCS_MAP_CP932){
+ if(c2 == 0xE3 && c1 == 0x82 && c0 == 0x94) return 1;
+ }else if(ms_ucs_map_f == UCS_MAP_MS){
+ switch(c2){
+ case 0xE2:
+ switch(c1){
+ case 0x80:
+ if(c0 == 0x94 || c0 == 0x96 || c0 == 0xBE) return 1;
+ break;
+ case 0x88:
+ if(c0 == 0x92) return 1;
+ break;
}
break;
- case 0x88:
- if(c0 == 0x92)
- return 1;
+ case 0xE3:
+ if(c1 == 0x80 || c0 == 0x9C) return 1;
break;
}
- break;
- case 0xE3:
- switch(c1){
- case 0x80:
- if(c0 == 0x9C)
- return 1;
+ }else{
+ switch(c2){
+ case 0xE2:
+ switch(c1){
+ case 0x80:
+ if(c0 == 0x95) return 1;
+ break;
+ case 0x88:
+ if(c0 == 0xA5) return 1;
+ break;
+ }
+ break;
+ case 0xEF:
+ switch(c1){
+ case 0xBC:
+ if(c0 == 0x8D) return 1;
+ break;
+ case 0xBF:
+ if(0xA0 <= c0 && c0 <= 0xA5) return 1;
+ break;
+ }
break;
}
- break;
}
- }else{
- /* eucJP-open */
- if(c2 == 0xE3 && c1 == 0x82 && c0 == 0x94)
- return 1;
}
- ret = w_iconv_common(c1, c0, utf8_to_euc_3bytes[c2 - 0xE0], sizeof_utf8_to_euc_C2, p2, p1);
+ ppp =
+ ms_ucs_map_f == UCS_MAP_CP932 ? utf8_to_euc_3bytes_932 :
+ ms_ucs_map_f == UCS_MAP_MS ? utf8_to_euc_3bytes_ms :
+ utf8_to_euc_3bytes;
+ ret = w_iconv_common(c1, c0, ppp[c2 - 0xE0], sizeof_utf8_to_euc_C2, p2, p1);
}else return -1;
return ret;
}
if (p == 0) return 1;
c0 -= 0x80;
- if (c0 < 0 || sizeof_utf8_to_euc_E5B8 <= c0) return 1;
+ if (c0 < 0 || sizeof_utf8_to_euc_C2 <= c0) return 1;
val = p[c0];
if (val == 0) return 1;
- if (disable_cp932ext_f && (
- (val>>8) == 0x2D || /* disable NEC special characters */
- val > 0xF300 /* disable NEC special characters */
+ if (no_cp932ext_f && (
+ (val>>8) == 0x2D || /* NEC special characters */
+ val > 0xF300 /* NEC special characters */
)) return 1;
c2 = val >> 8;
p = euc_to_utf8_1byte;
#ifdef X0212_ENABLE
} else if (c2 >> 8 == 0x8f){
- if(!ms_ucs_map_f && c2 == 0x8F22 && c1 == 0x43){
+ if(ms_ucs_map_f == UCS_MAP_ASCII&& c2 == 0x8F22 && c1 == 0x43){
return 0xA6;
}
extern const unsigned short *const x0212_to_utf8_2bytes[];
c2 &= 0x7f;
c2 = (c2&0x7f) - 0x21;
if (0<=c2 && c2<sizeof_euc_to_utf8_2bytes)
- p = ms_ucs_map_f ? euc_to_utf8_2bytes_ms[c2] : euc_to_utf8_2bytes[c2];
+ p = ms_ucs_map_f != UCS_MAP_ASCII ? euc_to_utf8_2bytes_ms[c2] : euc_to_utf8_2bytes[c2];
else
return 0;
}
#endif
iso2022jp_f = FALSE;
#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE)
- ms_ucs_map_f = 0;
+ ms_ucs_map_f = UCS_MAP_ASCII;
#endif
#if defined(UTF8_OUTPUT_ENABLE) && defined(UTF8_INPUT_ENABLE)
internal_unicode_f = FALSE;
#endif
#ifdef UTF8_INPUT_ENABLE
- strict_mapping_f = TRUE;
- disable_cp932ext_f = FALSE;
+ no_cp932ext_f = FALSE;
ignore_zwnbsp_f = TRUE;
- unicode_round_trip_f = FALSE;
+ no_best_fit_chars_f = FALSE;
encode_fallback = NULL;
unicode_subchar = '?';
#endif
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0xA242, 0x2171, 0x2172, 0xA270, 0x216F, 0xA243, 0x2178,
- 0x212F, 0xA26D, 0xA26C, 0x2263, 0x224C, 0x2D, 0xA26E, 0xA234,
+ 0x212F, 0xA26D, 0xA26C, 0, 0x224C, 0, 0xA26E, 0xA234,
+ 0x216B, 0x215E, 0, 0, 0x212D, 0, 0x2279, 0,
+ 0xA231, 0, 0xA26B, 0, 0, 0, 0, 0xA244,
+};
+const unsigned short utf8_to_euc_C2_ms[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0xA242, 0x2171, 0x2172, 0xA270, 0x5C, 0xA243, 0x2178,
+ 0x212F, 0xA26D, 0xA26C, 0, 0x224C, 0, 0xA26E, 0xA234,
+ 0x216B, 0x215E, 0, 0, 0x212D, 0, 0x2279, 0,
+ 0xA231, 0, 0xA26B, 0, 0, 0, 0, 0xA244,
+};
+const unsigned short utf8_to_euc_C2_932[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0x21, 0x2171, 0x2172, 0, 0x5C, 0x7C, 0x2178,
+ 0x212F, 0x63, 0x61, 0x2263, 0x224C, 0x2D, 0x52, 0x2131,
0x216B, 0x215E, 0x32, 0x33, 0x212D, 0x264C, 0x2279, 0x2126,
- 0xA231, 0x31, 0xA26B, 0x2264, 0, 0, 0, 0xA244,
+ 0x2124, 0x31, 0x6F, 0x2264, 0, 0, 0, 0,
};
const unsigned short utf8_to_euc_C3[] = {
0xAA22, 0xAA21, 0xAA24, 0xAA2A, 0xAA23, 0xAA29, 0xA921, 0xAA2E,
0xAA32, 0xAA31, 0xAA34, 0xAA33, 0xAA40, 0xAA3F, 0xAA42, 0xAA41,
- 0x44, 0xAA50, 0xAA52, 0xAA51, 0xAA54, 0xAA58, 0xAA53, 0x215F,
+ 0, 0xAA50, 0xAA52, 0xAA51, 0xAA54, 0xAA58, 0xAA53, 0x215F,
0xA92C, 0xAA63, 0xAA62, 0xAA65, 0xAA64, 0xAA72, 0xA930, 0xA94E,
0xAB22, 0xAB21, 0xAB24, 0xAB2A, 0xAB23, 0xAB29, 0xA941, 0xAB2E,
0xAB32, 0xAB31, 0xAB34, 0xAB33, 0xAB40, 0xAB3F, 0xAB42, 0xAB41,
0xA943, 0xAB50, 0xAB52, 0xAB51, 0xAB54, 0xAB58, 0xAB53, 0x2160,
0xA94C, 0xAB63, 0xAB62, 0xAB65, 0xAB64, 0xAB72, 0xA950, 0xAB73,
};
+const unsigned short utf8_to_euc_C3_932[] = {
+ 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43,
+ 0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49,
+ 0x44, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x215F,
+ 0x4F, 0x55, 0x55, 0x55, 0x55, 0x59, 0x54, 0x73,
+ 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x63,
+ 0x65, 0x65, 0x65, 0x65, 0x69, 0x69, 0x69, 0x69,
+ 0x64, 0x6E, 0x6F, 0x6F, 0x6F, 0x6F, 0x6F, 0x2160,
+ 0x6F, 0x75, 0x75, 0x75, 0x75, 0x79, 0x74, 0x79,
+};
const unsigned short utf8_to_euc_C4[] = {
0xAA27, 0xAB27, 0xAA25, 0xAB25, 0xAA28, 0xAB28, 0xAA2B, 0xAB2B,
0xAA2C, 0xAB2C, 0xAA2F, 0xAB2F, 0xAA2D, 0xAB2D, 0xAA30, 0xAB30,
0x2273, 0, 0x216C, 0x216D, 0, 0, 0, 0,
0, 0, 0, 0x2228, 0, 0, 0x2131, 0,
};
+const unsigned short utf8_to_euc_E280_ms[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x213E, 0, 0, 0, 0x213D, 0x213D, 0x2142, 0,
+ 0x2146, 0x2147, 0, 0, 0x2148, 0x2149, 0, 0,
+ 0x2277, 0x2278, 0, 0, 0, 0x2145, 0x2144, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2273, 0, 0x216C, 0x216D, 0, 0, 0, 0,
+ 0, 0, 0, 0x2228, 0, 0, 0x7E, 0,
+};
+const unsigned short utf8_to_euc_E280_932[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x213E, 0, 0, 0, 0, 0x213D, 0, 0,
+ 0x2146, 0x2147, 0, 0, 0x2148, 0x2149, 0, 0,
+ 0x2277, 0x2278, 0, 0, 0, 0x2145, 0x2144, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0x2273, 0, 0x216C, 0x216D, 0, 0, 0, 0,
+ 0, 0, 0, 0x2228, 0, 0, 0, 0,
+};
const unsigned short utf8_to_euc_E284[] = {
0, 0, 0, 0x216E, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0x2168, 0x2268, 0, 0,
0, 0, 0, 0, 0, 0x2266, 0, 0,
};
+const unsigned short utf8_to_euc_E288_932[] = {
+ 0x224F, 0, 0x225F, 0x2250, 0, 0, 0, 0x2260,
+ 0x223A, 0, 0, 0x223B, 0, 0, 0, 0,
+ 0, 0x2D74, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x2265, 0, 0, 0x2267, 0x2167, 0x2D78,
+ 0x225C, 0, 0, 0, 0, 0x2142, 0, 0x224A,
+ 0x224B, 0x2241, 0x2240, 0x2269, 0x226A, 0, 0x2D73, 0,
+ 0, 0, 0, 0, 0x2168, 0x2268, 0, 0,
+ 0, 0, 0, 0, 0, 0x2266, 0, 0,
+};
const unsigned short utf8_to_euc_E289[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
};
+const unsigned short utf8_to_euc_E380_932[] = {
+ 0x2121, 0x2122, 0x2123, 0x2137, 0, 0x2139, 0x213A, 0x213B,
+ 0x2152, 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159,
+ 0x215A, 0x215B, 0x2229, 0x222E, 0x214C, 0x214D, 0, 0,
+ 0, 0, 0, 0, 0, 0x2D60, 0, 0x2D61,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
const unsigned short utf8_to_euc_E381[] = {
0, 0x2421, 0x2422, 0x2423, 0x2424, 0x2425, 0x2426, 0x2427,
0x2428, 0x2429, 0x242A, 0x242B, 0x242C, 0x242D, 0x242E, 0x242F,
const unsigned short utf8_to_euc_E382[] = {
0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E, 0x246F,
+ 0x2470, 0x2471, 0x2472, 0x2473, 0, 0, 0, 0,
+ 0, 0, 0, 0x212B, 0x212C, 0x2135, 0x2136, 0,
+ 0, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, 0x2527,
+ 0x2528, 0x2529, 0x252A, 0x252B, 0x252C, 0x252D, 0x252E, 0x252F,
+ 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, 0x2537,
+ 0x2538, 0x2539, 0x253A, 0x253B, 0x253C, 0x253D, 0x253E, 0x253F,
+};
+const unsigned short utf8_to_euc_E382_932[] = {
+ 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
+ 0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E, 0x246F,
0x2470, 0x2471, 0x2472, 0x2473, 0x2574, 0, 0, 0,
0, 0, 0, 0x212B, 0x212C, 0x2135, 0x2136, 0,
0, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, 0x2527,
0x212E, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367,
0x2368, 0x2369, 0x236A, 0x236B, 0x236C, 0x236D, 0x236E, 0x236F,
0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377,
+ 0x2378, 0x2379, 0x237A, 0x2150, 0x2143, 0x2151, 0xA237, 0,
+ 0, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27,
+ 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F,
+ 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37,
+ 0x0E38, 0x0E39, 0x0E3A, 0x0E3B, 0x0E3C, 0x0E3D, 0x0E3E, 0x0E3F,
+};
+const unsigned short utf8_to_euc_EFBD_ms[] = {
+ 0x212E, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367,
+ 0x2368, 0x2369, 0x236A, 0x236B, 0x236C, 0x236D, 0x236E, 0x236F,
+ 0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377,
0x2378, 0x2379, 0x237A, 0x2150, 0x2143, 0x2151, 0x2141, 0,
0, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27,
0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F,
0, 0, 0, 0,
0, 0, 0, 0,
};
+const unsigned short *const utf8_to_euc_E2_ms[] = {
+ utf8_to_euc_E280_ms, 0, 0, 0,
+ utf8_to_euc_E284, utf8_to_euc_E285, utf8_to_euc_E286, utf8_to_euc_E287,
+ utf8_to_euc_E288, utf8_to_euc_E289, utf8_to_euc_E28A, 0,
+ utf8_to_euc_E28C, 0, 0, 0,
+ 0, utf8_to_euc_E291, 0, 0,
+ utf8_to_euc_E294, utf8_to_euc_E295, utf8_to_euc_E296, utf8_to_euc_E297,
+ utf8_to_euc_E298, utf8_to_euc_E299, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+};
+const unsigned short *const utf8_to_euc_E2_932[] = {
+ utf8_to_euc_E280_932, 0, 0, 0,
+ utf8_to_euc_E284, utf8_to_euc_E285, utf8_to_euc_E286, utf8_to_euc_E287,
+ utf8_to_euc_E288_932, utf8_to_euc_E289, utf8_to_euc_E28A, 0,
+ utf8_to_euc_E28C, 0, 0, 0,
+ 0, utf8_to_euc_E291, 0, 0,
+ utf8_to_euc_E294, utf8_to_euc_E295, utf8_to_euc_E296, utf8_to_euc_E297,
+ utf8_to_euc_E298, utf8_to_euc_E299, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+};
const unsigned short *const utf8_to_euc_E3[] = {
utf8_to_euc_E380, utf8_to_euc_E381, utf8_to_euc_E382, utf8_to_euc_E383,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
};
+const unsigned short *const utf8_to_euc_E3_932[] = {
+ utf8_to_euc_E380_932, utf8_to_euc_E381, utf8_to_euc_E382_932, utf8_to_euc_E383,
+ 0, 0, 0, 0,
+ utf8_to_euc_E388, 0, utf8_to_euc_E38A, 0,
+ utf8_to_euc_E38C, utf8_to_euc_E38D, utf8_to_euc_E38E, utf8_to_euc_E38F,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+};
const unsigned short *const utf8_to_euc_E4[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
utf8_to_euc_EFBC, utf8_to_euc_EFBD, utf8_to_euc_EFBE, utf8_to_euc_EFBF,
};
+const unsigned short *const utf8_to_euc_EF_ms[] = {
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ utf8_to_euc_EFA4, 0, 0, utf8_to_euc_EFA7,
+ utf8_to_euc_EFA8, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ utf8_to_euc_EFBC, utf8_to_euc_EFBD_ms, utf8_to_euc_EFBE, utf8_to_euc_EFBF,
+};
const unsigned short *const utf8_to_euc_2bytes[] = {
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
};
+const unsigned short *const utf8_to_euc_2bytes_ms[] = {
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, utf8_to_euc_C2_ms, utf8_to_euc_C3,
+ utf8_to_euc_C4, utf8_to_euc_C5, 0, utf8_to_euc_C7,
+ 0, 0, 0, utf8_to_euc_CB,
+ 0, 0, utf8_to_euc_CE, utf8_to_euc_CF,
+ utf8_to_euc_D0, utf8_to_euc_D1, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+};
+const unsigned short *const utf8_to_euc_2bytes_932[] = {
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, utf8_to_euc_C2_932, utf8_to_euc_C3_932,
+ utf8_to_euc_C4, utf8_to_euc_C5, 0, utf8_to_euc_C7,
+ 0, 0, 0, utf8_to_euc_CB,
+ 0, 0, utf8_to_euc_CE, utf8_to_euc_CF,
+ utf8_to_euc_D0, utf8_to_euc_D1, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+};
const unsigned short *const *const utf8_to_euc_3bytes[] = {
0, 0, utf8_to_euc_E2, utf8_to_euc_E3,
utf8_to_euc_E4, utf8_to_euc_E5, utf8_to_euc_E6, utf8_to_euc_E7,
utf8_to_euc_E8, utf8_to_euc_E9, 0, 0,
0, 0, 0, utf8_to_euc_EF,
};
+const unsigned short *const *const utf8_to_euc_3bytes_ms[] = {
+ 0, 0, utf8_to_euc_E2_ms, utf8_to_euc_E3,
+ utf8_to_euc_E4, utf8_to_euc_E5, utf8_to_euc_E6, utf8_to_euc_E7,
+ utf8_to_euc_E8, utf8_to_euc_E9, 0, 0,
+ 0, 0, 0, utf8_to_euc_EF_ms,
+};
+const unsigned short *const *const utf8_to_euc_3bytes_932[] = {
+ 0, 0, utf8_to_euc_E2_932, utf8_to_euc_E3_932,
+ utf8_to_euc_E4, utf8_to_euc_E5, utf8_to_euc_E6, utf8_to_euc_E7,
+ utf8_to_euc_E8, utf8_to_euc_E9, 0, 0,
+ 0, 0, 0, utf8_to_euc_EF_ms,
+};
#ifdef UNICODE_NORMALIZATION
0, 0, 0, 0, 0, 0, 0, 0,
0, 0x8143, 0, 0, 0x8150, 0, 0, 0x8160,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0x21, 0xFA55, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0x6f, 0x61, 0x63, 0x52, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_A9[] = {
- 0x41, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0x4F, 0, 0, 0,
- 0x54, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0x61, 0, 0x64, 0, 0, 0, 0,
- 0, 0, 0, 0, 0x6f, 0, 0x73, 0,
- 0x74, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0xFA55, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_AA[] = {
- 0x41, 0x41, 0x41, 0x41, 0, 0, 0,
- 0, 0x41, 0x41, 0, 0, 0, 0x43, 0,
- 0, 0x45, 0x45, 0x45, 0x45, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0x49,
- 0x49, 0x49, 0x49, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0, 0, 0,
- 0x4F, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0x55, 0x55, 0x55, 0x55, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0x59, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0,
-};
-const unsigned short x0212_shiftjis_AB[] = {
- 0x61, 0x61, 0x61, 0x61, 0, 0, 0,
- 0, 0x61, 0x61, 0, 0, 0, 0x63, 0,
- 0, 0x65, 0x65, 0x65, 0x65, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0x69,
- 0x69, 0x69, 0x69, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0x6E, 0x6F, 0x6F, 0x6F, 0x6F, 0, 0, 0,
- 0x6F, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0x75, 0x75, 0x75, 0x75, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0x79, 0x79, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
};
const unsigned short x0212_shiftjis_B0[] = {
const unsigned short *const x0212_shiftjis[] = {
0, x0212_shiftjis_A2, 0,
0, 0, 0, 0,
- 0, x0212_shiftjis_A9, x0212_shiftjis_AA, x0212_shiftjis_AB,
+ 0, 0, 0, 0,
0, 0, 0, 0,
x0212_shiftjis_B0, x0212_shiftjis_B1, x0212_shiftjis_B2, x0212_shiftjis_B3,
x0212_shiftjis_B4, x0212_shiftjis_B5, 0, x0212_shiftjis_B7,