--- embedaddon/libiconv/lib/gb18030ext.h 2012/02/21 22:57:48 1.1.1.1 +++ embedaddon/libiconv/lib/gb18030ext.h 2012/05/29 09:29:43 1.1.1.2 @@ -1,5 +1,5 @@ /* - * Copyright (C) 1999-2001, 2005 Free Software Foundation, Inc. + * Copyright (C) 1999-2001, 2005, 2011 Free Software Foundation, Inc. * This file is part of the GNU LIBICONV Library. * * The GNU LIBICONV Library is free software; you can redistribute it @@ -27,20 +27,20 @@ static const unsigned short gb18030ext_2uni_pagea9[13] 0x303e, 0x2ff0, 0x2ff1, 0x2ff2, 0x2ff3, 0x2ff4, 0x2ff5, 0x2ff6, 0x2ff7, 0x2ff8, 0x2ff9, 0x2ffa, 0x2ffb, }; -static const unsigned short gb18030ext_2uni_pagefe[96] = { +static const unsigned int gb18030ext_2uni_pagefe[96] = { /* 0xfe */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x2e81, 0xe816, 0xe817, 0xe818, 0x2e84, 0x3473, 0x3447, 0x2e88, - 0x2e8b, 0xe81e, 0x359e, 0x361a, 0x360e, 0x2e8c, 0x2e97, 0x396e, - 0x3918, 0xe826, 0x39cf, 0x39df, 0x3a73, 0x39d0, 0xe82b, 0xe82c, - 0x3b4e, 0x3c6e, 0x3ce0, 0x2ea7, 0xe831, 0xe832, 0x2eaa, 0x4056, - 0x415f, 0x2eae, 0x4337, 0x2eb3, 0x2eb6, 0x2eb7, 0xe83b, 0x43b1, - 0x43ac, 0x2ebb, 0x43dd, 0x44d6, 0x4661, 0x464c, 0xe843, 0x4723, - 0x4729, 0x477c, 0x478d, 0x2eca, 0x4947, 0x497a, 0x497d, 0x4982, - 0x4983, 0x4985, 0x4986, 0x499f, 0x499b, 0x49b7, 0x49b6, 0xe854, - 0xe855, 0x4ca3, 0x4c9f, 0x4ca0, 0x4ca1, 0x4c77, 0x4ca2, 0x4d13, - 0x4d14, 0x4d15, 0x4d16, 0x4d17, 0x4d18, 0x4d19, 0x4dae, 0xe864, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x2e81, 0x20087, 0x20089, 0x200cc, 0x2e84, 0x3473, 0x3447, 0x2e88, + 0x2e8b, 0x9fb4, 0x359e, 0x361a, 0x360e, 0x2e8c, 0x2e97, 0x396e, + 0x3918, 0x9fb5, 0x39cf, 0x39df, 0x3a73, 0x39d0, 0x9fb6, 0x9fb7, + 0x3b4e, 0x3c6e, 0x3ce0, 0x2ea7, 0x215d7, 0x9fb8, 0x2eaa, 0x4056, + 0x415f, 0x2eae, 0x4337, 0x2eb3, 0x2eb6, 0x2eb7, 0x2298f, 0x43b1, + 0x43ac, 0x2ebb, 0x43dd, 0x44d6, 0x4661, 0x464c, 0x9fb9, 0x4723, + 0x4729, 0x477c, 0x478d, 0x2eca, 0x4947, 0x497a, 0x497d, 0x4982, + 0x4983, 0x4985, 0x4986, 0x499f, 0x499b, 0x49b7, 0x49b6, 0x9fba, + 0x241fe, 0x4ca3, 0x4c9f, 0x4ca0, 0x4ca1, 0x4c77, 0x4ca2, 0x4d13, + 0x4d14, 0x4d15, 0x4d16, 0x4d17, 0x4d18, 0x4d19, 0x4dae, 0x9fbb, }; static int @@ -52,7 +52,7 @@ gb18030ext_mbtowc (conv_t conv, ucs4_t *pwc, const uns unsigned char c2 = s[1]; if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0x80 && c2 < 0xff)) { unsigned int i = 190 * (c1 - 0x81) + (c2 - (c2 >= 0x80 ? 0x41 : 0x40)); - unsigned short wc = 0xfffd; + unsigned int wc = 0xfffd; switch (c1) { case 0xa2: if (i >= 6376 && i <= 6381) /* 0xA2AB..0xA2B0 */ @@ -77,12 +77,14 @@ gb18030ext_mbtowc (conv_t conv, ucs4_t *pwc, const uns case 0xa6: if (i >= 7150 && i <= 7157) /* 0xA6B9..0xA6C0 */ wc = 0xe785 + (i - 7150); + else if (i >= 7183 && i <= 7184) /* 0xA6DA..0xA6DB */ + wc = 0xfe12 - (i - 7183); else if (i >= 7182 && i <= 7190) /* 0xA6D9..0xA6DF */ - wc = 0xe78d + (i - 7182); + wc = 0xfe10 + (i - 7182); else if (i >= 7201 && i <= 7202) /* 0xA6EC..0xA6ED */ - wc = 0xe794 + (i - 7201); + wc = 0xfe17 + (i - 7201); else if (i == 7208) /* 0xA6F3 */ - wc = 0xe796; + wc = 0xfe19; else if (i >= 7211 && i <= 7219) /* 0xA6F6..0xA6FE */ wc = 0xe797 + (i - 7211); break; @@ -96,7 +98,7 @@ gb18030ext_mbtowc (conv_t conv, ucs4_t *pwc, const uns if (i >= 7495 && i <= 7505) /* 0xA896..0xA8A0 */ wc = 0xe7bc + (i - 7495); else if (i == 7533) /* 0xA8BC */ - wc = 0xe7c7; + wc = 0x1e3f; else if (i == 7536) /* 0xA8BF */ wc = 0x01f9; else if (i >= 7538 && i <= 7541) /* 0xA8C1..0xA8C4 */ @@ -230,6 +232,14 @@ static const unsigned short gb18030ext_page4d[16] = { 0x0000, 0x0000, 0x0000, 0xfe98, 0xfe99, 0xfe9a, 0xfe9b, 0xfe9c, /*0x10-0x17*/ 0xfe9d, 0xfe9e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/ }; +static const unsigned short gb18030ext_page9f[16] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0xfe59, 0xfe61, 0xfe66, 0xfe67, /*0xb0-0xb7*/ + 0xfe6d, 0xfe7e, 0xfe90, 0xfea0, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb8-0xbf*/ +}; +static const unsigned short gb18030ext_pagefe[16] = { + 0xa6d9, 0xa6db, 0xa6da, 0xa6dc, 0xa6dd, 0xa6de, 0xa6df, 0xa6ec, /*0x10-0x17*/ + 0xa6ed, 0xa6f3, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/ +}; static int gb18030ext_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) @@ -238,6 +248,8 @@ gb18030ext_wctomb (conv_t conv, unsigned char *r, ucs4 unsigned short c = 0; if (wc == 0x01f9) c = 0xa8bf; + else if (wc == 0x1e3f) + c = 0xa8bc; else if (wc == 0x20ac) c = 0xa2e3; else if (wc >= 0x2e80 && wc < 0x2ed0) @@ -290,6 +302,22 @@ gb18030ext_wctomb (conv_t conv, unsigned char *r, ucs4 c = gb18030ext_page4d[wc-0x4d10]; else if (wc == 0x4dae) c = 0xfe9f; + else if (wc >= 0x9fb4 && wc < 0x9fbc) + c = gb18030ext_page9f[wc-0x9fb0]; + else if (wc >= 0xfe10 && wc < 0xfe1a) + c = gb18030ext_pagefe[wc-0xfe10]; + else if (wc == 0x20087) + c = 0xfe51; + else if (wc == 0x20089) + c = 0xfe52; + else if (wc == 0x200cc) + c = 0xfe53; + else if (wc == 0x215d7) + c = 0xfe6c; + else if (wc == 0x2298f) + c = 0xfe76; + else if (wc == 0x241fe) + c = 0xfe91; if (c != 0) { r[0] = (c >> 8); r[1] = (c & 0xff); return 2;