From 39c951ed8830b0e3c7bac074850b4d4cc47de56e Mon Sep 17 00:00:00 2001 From: Rui Hirokawa Date: Sun, 5 May 2002 02:22:36 +0000 Subject: [PATCH] added missing areas on Unicode->CP936 conversion table. added an alias CP932 on sjis-win. --- ext/mbstring/mbfilter.c | 2 +- ext/mbstring/mbfilter_cn.c | 14 +++-- ext/mbstring/unicode_table_cn.h | 105 +++++++++++++++++++++++--------- 3 files changed, 88 insertions(+), 33 deletions(-) diff --git a/ext/mbstring/mbfilter.c b/ext/mbstring/mbfilter.c index 968ee515ef..4577311c74 100644 --- a/ext/mbstring/mbfilter.c +++ b/ext/mbstring/mbfilter.c @@ -653,7 +653,7 @@ static mbfl_encoding mbfl_encoding_eucjp_win = { MBFL_ENCTYPE_MBCS }; -static const char *mbfl_encoding_sjis_win_aliases[] = {"SJIS-open", "MS_Kanji", "Windows-31J", NULL}; +static const char *mbfl_encoding_sjis_win_aliases[] = {"SJIS-open", "MS_Kanji", "Windows-31J", "CP932", NULL}; static mbfl_encoding mbfl_encoding_sjis_win = { mbfl_no_encoding_sjis_win, diff --git a/ext/mbstring/mbfilter_cn.c b/ext/mbstring/mbfilter_cn.c index 8b03c384b1..41123b57c6 100644 --- a/ext/mbstring/mbfilter_cn.c +++ b/ext/mbstring/mbfilter_cn.c @@ -111,8 +111,8 @@ mbfl_filt_conv_wchar_euccn(int c, mbfl_convert_filter *filter TSRMLS_DC) s = ucs_a3_cp936_table[c - ucs_a3_cp936_table_min]; } else if (c >= ucs_i_cp936_table_min && c < ucs_i_cp936_table_max) { s = ucs_i_cp936_table[c - ucs_i_cp936_table_min]; - } else if (c >= ucs_r_cp936_table_min && c < ucs_r_cp936_table_max) { - s = ucs_r_cp936_table[c - ucs_r_cp936_table_min]; + } else if (c >= ucs_hff_cp936_table_min && c < ucs_hff_cp936_table_max) { + s = ucs_hff_cp936_table[c - ucs_hff_cp936_table_min]; } c1 = (s >> 8) & 0xff; c2 = s & 0xff; @@ -223,8 +223,14 @@ mbfl_filt_conv_wchar_cp936(int c, mbfl_convert_filter *filter TSRMLS_DC) s = ucs_a3_cp936_table[c - ucs_a3_cp936_table_min]; } else if (c >= ucs_i_cp936_table_min && c < ucs_i_cp936_table_max) { s = ucs_i_cp936_table[c - ucs_i_cp936_table_min]; - } else if (c >= ucs_r_cp936_table_min && c < ucs_r_cp936_table_max) { - s = ucs_r_cp936_table[c - ucs_r_cp936_table_min]; + } else if (c >= ucs_ci_cp936_table_min && c < ucs_ci_cp936_table_max) { + s = ucs_ci_cp936_table[c - ucs_ci_cp936_table_min]; + } else if (c >= ucs_cf_cp936_table_min && c < ucs_cf_cp936_table_max) { + s = ucs_cf_cp936_table[c - ucs_cf_cp936_table_min]; + } else if (c >= ucs_sfv_cp936_table_min && c < ucs_sfv_cp936_table_max) { + s = ucs_sfv_cp936_table[c - ucs_sfv_cp936_table_min]; + } else if (c >= ucs_hff_cp936_table_min && c < ucs_hff_cp936_table_max) { + s = ucs_hff_cp936_table[c - ucs_hff_cp936_table_min]; } if (s <= 0) { c1 = c & ~MBFL_WCSPLANE_MASK; diff --git a/ext/mbstring/unicode_table_cn.h b/ext/mbstring/unicode_table_cn.h index dcb847afbe..ca440a3de9 100644 --- a/ext/mbstring/unicode_table_cn.h +++ b/ext/mbstring/unicode_table_cn.h @@ -3279,32 +3279,12 @@ static const unsigned short ucs_a1_cp936_table[] = { 0xa7da,0xa7db,0xa7dc,0xa7dd,0xa7de,0xa7df,0xa7e0,0xa7e1, 0xa7e2,0xa7e3,0xa7e4,0xa7e5,0xa7e6,0xa7e7,0xa7e8,0xa7e9, 0xa7ea,0xa7eb,0xa7ec,0xa7ed,0xa7ee,0xa7ef,0xa7f0,0xa7f1, -0x0000,0xa7d7,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, -0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 -}; +0x0000,0xa7d7}; + static const int ucs_a1_cp936_table_min = 0x0000; static const int ucs_a1_cp936_table_max = 0x0000 + (sizeof (ucs_a1_cp936_table) / sizeof (unsigned short)); +/* 0x2000 */ static const unsigned short ucs_a2_cp936_table[] = { 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, @@ -3470,6 +3450,7 @@ static const unsigned short ucs_a2_cp936_table[] = { 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +/* 0x2500 */ 0xa9a4,0xa9a5,0xa9a6,0xa9a7,0xa9a8,0xa9a9,0xa9aa,0xa9ab, 0xa9ac,0xa9ad,0xa9ae,0xa9af,0xa9b0,0xa9b1,0xa9b2,0xa9b3, 0xa9b4,0xa9b5,0xa9b6,0xa9b7,0xa9b8,0xa9b9,0xa9ba,0xa9bb, @@ -3709,7 +3690,7 @@ static const unsigned short ucs_a3_cp936_table[] = { static const int ucs_a3_cp936_table_min = 0x2f00; static const int ucs_a3_cp936_table_max = 0x2f00 + (sizeof (ucs_a3_cp936_table) / sizeof (unsigned short)); -/* 4d00h */ +/* 4d00h CJK Unified Ideographs (+ Extension A) */ static const unsigned short ucs_i_cp936_table[] = { /* 0x4d00 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, @@ -6372,8 +6353,76 @@ static const unsigned short ucs_i_cp936_table[] = { static const int ucs_i_cp936_table_min = 0x4d00; static const int ucs_i_cp936_table_max = 0x4d00 + (sizeof (ucs_i_cp936_table) / sizeof (unsigned short)); - /* FF00h */ -static const unsigned short ucs_r_cp936_table[] = { + + +/* 0xf900 CJK Compatibility Ideographs */ +static const unsigned short ucs_ci_cp936_table[] = { +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xfd9c,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xfd9d,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0xfd9e,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfd9f, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0xfda0,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +/* 0xfa00 */ +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0xfe40,0xfe41,0xfe42,0xfe43, +0x0000,0xfe44,0x0000,0xfe45,0xfe46,0x0000,0x0000,0x0000, +0xfe47,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0xfe48, +0xfe49,0xfe4a,0x0000,0xfe4b,0xfe4c,0x0000,0x0000,0xfe4d, +0xfe4e,0xfe4f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}; +static const int ucs_ci_cp936_table_min = 0xf900; +static const int ucs_ci_cp936_table_max = 0xf900 + (sizeof (ucs_ci_cp936_table) / sizeof (unsigned short)); + + + /* FE30h CJK Compatibility Forms */ +static const unsigned short ucs_cf_cp936_table[] = { +0xa955,0xa6f2,0x0000,0xa6f4,0xa6f5,0xa6e0,0xa6e1,0xa6f0, +0xa6f1,0xa6e2,0xa6e3,0xa6ee,0xa6ef,0xa6e6,0xa6e7,0xa6e4, +0xa6e5,0xa6e8,0xa6e9,0xa6ea,0xa6eb,0x0000,0x0000,0x0000, +0x0000,0xa968,0xa969,0xa96a,0xa96b,0xa96c,0xa96d,0xa96e}; + +static const int ucs_cf_cp936_table_min = 0xfe30; +static const int ucs_cf_cp936_table_max = 0xfe30 + (sizeof (ucs_cf_cp936_table) / sizeof (unsigned short)); + + + /* FE50h Small Form Variants */ +static const unsigned short ucs_sfv_cp936_table[] = { +0xa96f,0xa970,0xa971,0x0000,0xa972,0xa973,0xa974,0xa975, +0x0000,0xa976,0xa977,0xa978,0xa979,0xa97a,0xa97b,0xa97c, +0xa97d,0xa97e,0xa980,0xa981,0xa982,0xa983,0xa984,0x0000, +0xa985,0xa986,0xa987,0xa988,0x0000,0x0000,0x0000,0x0000}; + +static const int ucs_sfv_cp936_table_min = 0xfe50; +static const int ucs_sfv_cp936_table_max = 0xfe50 + (sizeof (ucs_sfv_cp936_table) / sizeof (unsigned short)); + + /* FF00h Halfwidth and Fullwidth Forms */ +static const unsigned short ucs_hff_cp936_table[] = { 0x0000,0xa3a1,0xa3a2,0xa3a3,0xa1e7,0xa3a5,0xa3a6,0xa3a7, 0xa3a8,0xa3a9,0xa3aa,0xa3ab,0xa3ac,0xa3ad,0xa3ae,0xa3af, 0xa3b0,0xa3b1,0xa3b2,0xa3b3,0xa3b4,0xa3b5,0xa3b6,0xa3b7, @@ -6407,8 +6456,8 @@ static const unsigned short ucs_r_cp936_table[] = { 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 }; -static const int ucs_r_cp936_table_min = 0xff00; -static const int ucs_r_cp936_table_max = 0xff00 + (sizeof (ucs_r_cp936_table) / sizeof (unsigned short)); +static const int ucs_hff_cp936_table_min = 0xff00; +static const int ucs_hff_cp936_table_max = 0xff00 + (sizeof (ucs_hff_cp936_table) / sizeof (unsigned short)); -- 2.50.1