mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
eci.c: fix bad bug in Korean, return EUC-KR instead of raw KS X 1001
This commit is contained in:
parent
2c053c325a
commit
7f74414666
@ -109,8 +109,9 @@ static int gb2312_wctomb(unsigned char *r, const unsigned int wc) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ECI 30 KS X 1001 (KS C 5601) Korean */
|
||||
static int ksx1001_wctomb(unsigned char *r, const unsigned int wc) {
|
||||
/* ECI 30 EUC-KR (KS X 1001, formerly KS C 5601) Korean
|
||||
* See euc_kr_wctomb() in libiconv-1.16/lib/euc_kr.h */
|
||||
static int euc_kr_wctomb(unsigned char *r, const unsigned int wc) {
|
||||
unsigned int c;
|
||||
|
||||
if (wc < 0x80) {
|
||||
@ -118,8 +119,8 @@ static int ksx1001_wctomb(unsigned char *r, const unsigned int wc) {
|
||||
return 1;
|
||||
}
|
||||
if (ksx1001_wctomb_zint(&c, wc)) {
|
||||
r[0] = (unsigned char) (c >> 8);
|
||||
r[1] = (unsigned char) (c & 0xff);
|
||||
r[0] = (unsigned char) ((c >> 8) + 0x80);
|
||||
r[1] = (unsigned char) ((c & 0xff) + 0x80);
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
@ -170,7 +171,7 @@ INTERNAL int get_eci_length(const int eci, const unsigned char source[], int len
|
||||
length *= 2;
|
||||
}
|
||||
|
||||
/* Big5 and KS X 1001 fit in UTF-8 length */
|
||||
/* Big5 and EUC-KR fit in UTF-8 length */
|
||||
|
||||
return length;
|
||||
}
|
||||
@ -186,7 +187,7 @@ INTERNAL int utf8_to_eci(const int eci, const unsigned char source[], unsigned c
|
||||
iso8859_13_wctosb, iso8859_14_wctosb, iso8859_15_wctosb, iso8859_16_wctosb, NULL,
|
||||
sjis_wctomb, cp1250_wctosb, cp1251_wctosb, cp1252_wctosb, cp1256_wctosb,
|
||||
ucs2be_wctomb, NULL, ascii_wctosb, big5_wctomb, gb2312_wctomb,
|
||||
ksx1001_wctomb,
|
||||
euc_kr_wctomb,
|
||||
};
|
||||
eci_func_t eci_func;
|
||||
unsigned int codepoint, state;
|
||||
|
@ -213,8 +213,8 @@ static void test_reduced_charset_input(int index, int debug) {
|
||||
/* 76*/ { BARCODE_PDF417, UNICODE_MODE, 29, "齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/* 77*/ { BARCODE_PDF417, UNICODE_MODE, 29, "齄齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/* 78*/ { BARCODE_PDF417, UNICODE_MODE, 0, "가", ZINT_WARN_USES_ECI, 26, "Not in any single-byte page" },
|
||||
/* 79*/ { BARCODE_PDF417, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/* 80*/ { BARCODE_PDF417, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/* 79*/ { BARCODE_PDF417, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/* 80*/ { BARCODE_PDF417, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/* 81*/ { BARCODE_PDF417, UNICODE_MODE, 31, "A", 0, 31, "Undefined character set ECI - ignored for character set conversion" },
|
||||
/* 82*/ { BARCODE_PDF417, UNICODE_MODE, 170, "?", 0, 170, "ASCII invariant" },
|
||||
/* 83*/ { BARCODE_PDF417, UNICODE_MODE, 170, "@", ZINT_ERROR_INVALID_DATA, -1, "Not in ASCII invariant" },
|
||||
@ -238,8 +238,8 @@ static void test_reduced_charset_input(int index, int debug) {
|
||||
/*101*/ { BARCODE_PDF417COMP, UNICODE_MODE, 28, "龘龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*102*/ { BARCODE_PDF417COMP, UNICODE_MODE, 29, "齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*103*/ { BARCODE_PDF417COMP, UNICODE_MODE, 29, "齄齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*104*/ { BARCODE_PDF417COMP, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*105*/ { BARCODE_PDF417COMP, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*104*/ { BARCODE_PDF417COMP, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*105*/ { BARCODE_PDF417COMP, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*106*/ { BARCODE_MAXICODE, UNICODE_MODE, 0, "é", 0, 0, "" },
|
||||
/*107*/ { BARCODE_MAXICODE, UNICODE_MODE, 3, "é", 0, 3, "Supports ECI" },
|
||||
/*108*/ { BARCODE_MAXICODE, UNICODE_MODE, 0, "β", ZINT_WARN_USES_ECI, 9, "" },
|
||||
@ -256,8 +256,8 @@ static void test_reduced_charset_input(int index, int debug) {
|
||||
/*119*/ { BARCODE_MAXICODE, UNICODE_MODE, 28, "龘龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*120*/ { BARCODE_MAXICODE, UNICODE_MODE, 29, "齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*121*/ { BARCODE_MAXICODE, UNICODE_MODE, 29, "齄齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*122*/ { BARCODE_MAXICODE, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*123*/ { BARCODE_MAXICODE, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*122*/ { BARCODE_MAXICODE, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*123*/ { BARCODE_MAXICODE, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*124*/ { BARCODE_CODE128B, UNICODE_MODE, 0, "é", 0, 0, "" },
|
||||
/*125*/ { BARCODE_CODE128B, UNICODE_MODE, 3, "é", ZINT_ERROR_INVALID_OPTION, -1, "Does not support ECI" },
|
||||
/*126*/ { BARCODE_CODE128B, UNICODE_MODE, 0, "β", ZINT_ERROR_INVALID_DATA, -1, "β not in ISO 8859-1" },
|
||||
@ -276,8 +276,8 @@ static void test_reduced_charset_input(int index, int debug) {
|
||||
/*139*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "龘龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*140*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 29, "齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*141*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 29, "齄齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*142*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*143*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*142*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*143*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*144*/ { BARCODE_CODABLOCKF, UNICODE_MODE, 0, "é", 0, 0, "" },
|
||||
/*145*/ { BARCODE_CODABLOCKF, UNICODE_MODE, 3, "é", ZINT_ERROR_INVALID_OPTION, -1, "Does not support ECI" },
|
||||
/*146*/ { BARCODE_CODABLOCKF, UNICODE_MODE, 0, "β", ZINT_ERROR_INVALID_DATA, -1, "β not in ISO 8859-1" },
|
||||
@ -297,8 +297,8 @@ static void test_reduced_charset_input(int index, int debug) {
|
||||
/*160*/ { BARCODE_MICROPDF417, UNICODE_MODE, 28, "龘龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*161*/ { BARCODE_MICROPDF417, UNICODE_MODE, 29, "齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*162*/ { BARCODE_MICROPDF417, UNICODE_MODE, 29, "齄齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*163*/ { BARCODE_MICROPDF417, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*164*/ { BARCODE_MICROPDF417, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*163*/ { BARCODE_MICROPDF417, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*164*/ { BARCODE_MICROPDF417, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*165*/ { BARCODE_USPS_IMAIL, UNICODE_MODE, 0, "é", ZINT_ERROR_INVALID_DATA, -1, "Numbers/dash only" },
|
||||
/*166*/ { BARCODE_AZTEC, UNICODE_MODE, 0, "é", 0, 0, "" },
|
||||
/*167*/ { BARCODE_AZTEC, UNICODE_MODE, 3, "é", 0, 3, "Supports ECI" },
|
||||
@ -315,8 +315,8 @@ static void test_reduced_charset_input(int index, int debug) {
|
||||
/*178*/ { BARCODE_AZTEC, UNICODE_MODE, 28, "龘龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*179*/ { BARCODE_AZTEC, UNICODE_MODE, 29, "齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*180*/ { BARCODE_AZTEC, UNICODE_MODE, 29, "齄齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*181*/ { BARCODE_AZTEC, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*182*/ { BARCODE_AZTEC, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*181*/ { BARCODE_AZTEC, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*182*/ { BARCODE_AZTEC, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*183*/ { BARCODE_HIBC_128, UNICODE_MODE, 0, "é", ZINT_ERROR_INVALID_DATA, -1, "HIBC ASCII subset only" },
|
||||
/*184*/ { BARCODE_HIBC_AZTEC, UNICODE_MODE, 0, "é", ZINT_ERROR_INVALID_DATA, -1, "HIBC ASCII subset only" },
|
||||
/*185*/ { BARCODE_DOTCODE, UNICODE_MODE, 0, "é", 0, 0, "" },
|
||||
@ -334,8 +334,8 @@ static void test_reduced_charset_input(int index, int debug) {
|
||||
/*197*/ { BARCODE_DOTCODE, UNICODE_MODE, 28, "龘龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*198*/ { BARCODE_DOTCODE, UNICODE_MODE, 29, "齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*199*/ { BARCODE_DOTCODE, UNICODE_MODE, 29, "齄齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*200*/ { BARCODE_DOTCODE, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*201*/ { BARCODE_DOTCODE, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*200*/ { BARCODE_DOTCODE, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*201*/ { BARCODE_DOTCODE, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*202*/ { BARCODE_AZRUNE, UNICODE_MODE, 0, "é", ZINT_ERROR_INVALID_DATA, -1, "Numbers <= 255 only" },
|
||||
/*203*/ { BARCODE_CODE32, UNICODE_MODE, 0, "é", ZINT_ERROR_INVALID_DATA, -1, "Numbers only" },
|
||||
/*204*/ { BARCODE_CODEONE, UNICODE_MODE, 0, "é", 0, 0, "" },
|
||||
@ -353,8 +353,8 @@ static void test_reduced_charset_input(int index, int debug) {
|
||||
/*216*/ { BARCODE_CODEONE, UNICODE_MODE, 28, "龘龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*217*/ { BARCODE_CODEONE, UNICODE_MODE, 29, "齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*218*/ { BARCODE_CODEONE, UNICODE_MODE, 29, "齄齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*219*/ { BARCODE_CODEONE, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*220*/ { BARCODE_CODEONE, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*219*/ { BARCODE_CODEONE, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*220*/ { BARCODE_CODEONE, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*221*/ { BARCODE_ULTRA, UNICODE_MODE, 0, "é", 0, 0, "" },
|
||||
/*222*/ { BARCODE_ULTRA, UNICODE_MODE, 3, "é", 0, 3, "Supports ECI" },
|
||||
/*223*/ { BARCODE_ULTRA, UNICODE_MODE, 0, "β", ZINT_WARN_USES_ECI, 9, "" },
|
||||
@ -370,8 +370,8 @@ static void test_reduced_charset_input(int index, int debug) {
|
||||
/*233*/ { BARCODE_ULTRA, UNICODE_MODE, 28, "龘龘", 0, 28, "U+9F98 in Big5 but not in GB2312" },
|
||||
/*234*/ { BARCODE_ULTRA, UNICODE_MODE, 29, "齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*235*/ { BARCODE_ULTRA, UNICODE_MODE, 29, "齄齄", 0, 29, "U+9F44 in GB2312 but not in Big5" },
|
||||
/*236*/ { BARCODE_ULTRA, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*237*/ { BARCODE_ULTRA, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in KS X 1001" },
|
||||
/*236*/ { BARCODE_ULTRA, UNICODE_MODE, 30, "가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
/*237*/ { BARCODE_ULTRA, UNICODE_MODE, 30, "가가", 0, 30, "U+AC00 in EUC-KR" },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
|
||||
|
@ -278,10 +278,10 @@ static void test_gb18030_utf8_to_eci(int index) {
|
||||
/* 45*/ { 29, 0, "・", -1, 0, 2, { 0xA1, 0xA4 }, "GB 2312 U+30FB" },
|
||||
/* 46*/ { 29, 1, "・", -1, 0, 1, { 0xA1A4 }, "GB 2312" },
|
||||
/* 47*/ { 29, 0, "釦", -1, ZINT_ERROR_INVALID_DATA, -1, {}, "GB 18030 U+91E6 not in GB 2312" },
|
||||
/* 48*/ { 30, 0, "¡¡", -1, 0, 4, { 0x22, 0x2E, 0x22, 0x2E }, "KS X 1001 U+00A1" },
|
||||
/* 49*/ { 30, 1, "¡¡", -1, 0, 4, { 0x22, 0x2E, 0x22, 0x2E }, "KS X 1001 outside GB 18030 Hanzi mode range" },
|
||||
/* 50*/ { 30, 0, "詰", -1, 0, 2, { 0x7D, 0x7E }, "KS X 1001 U+8A70" },
|
||||
/* 51*/ { 30, 1, "詰", -1, 0, 2, { 0x7D, 0x7E }, "KS X 1001 <= 0x7D7E so none in GB 18030 Hanzi mode range" },
|
||||
/* 48*/ { 30, 0, "¡¡", -1, 0, 4, { 0x22 + 0x80, 0x2E + 0x80, 0x22 + 0x80, 0x2E + 0x80 }, "EUC-KR U+00A1 (0xA2AE)" },
|
||||
/* 49*/ { 30, 1, "¡¡", -1, 0, 2, { 0x222E + 0x8080, 0x222E + 0x8080 }, "All EUC-KR in GB 18030 Hanzi mode range" },
|
||||
/* 50*/ { 30, 0, "詰", -1, 0, 2, { 0x7D + 0x80, 0x7E + 0x80 }, "EUC-KR U+8A70 (0xFDFE)" },
|
||||
/* 51*/ { 30, 1, "詰", -1, 0, 1, { 0x7D7E + 0x8080 }, "All EUC-KR in GB 18030 Hanzi mode range" },
|
||||
};
|
||||
|
||||
int data_size = sizeof(data) / sizeof(struct item);
|
||||
@ -300,7 +300,7 @@ static void test_gb18030_utf8_to_eci(int index) {
|
||||
if (ret == 0) {
|
||||
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
|
||||
for (int j = 0; j < (int) ret_length; j++) {
|
||||
assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] %04X != %04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]);
|
||||
assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] 0x%04X != 0x%04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -216,10 +216,10 @@ static void test_gb2312_utf8_to_eci(int index) {
|
||||
/* 37*/ { 29, 0, "・", -1, 0, 2, { 0xA1, 0xA4 }, "GB 2312 U+30FB" },
|
||||
/* 38*/ { 29, 1, "・", -1, 0, 1, { 0xA1A4 }, "GB 2312" },
|
||||
/* 39*/ { 29, 0, "釦", -1, ZINT_ERROR_INVALID_DATA, -1, {}, "GB 18030 U+91E6 not in GB 2312" },
|
||||
/* 40*/ { 30, 0, "¡¡", -1, 0, 4, { 0x22, 0x2E, 0x22, 0x2E }, "KS X 1001 U+00A1" },
|
||||
/* 41*/ { 30, 1, "¡¡", -1, 0, 4, { 0x22, 0x2E, 0x22, 0x2E }, "KS X 1001 outside GB 2312 Hanzi mode range" },
|
||||
/* 42*/ { 30, 0, "詰", -1, 0, 2, { 0x7D, 0x7E }, "KS X 1001 U+8A70" },
|
||||
/* 43*/ { 30, 1, "詰", -1, 0, 2, { 0x7D, 0x7E }, "KS X 1001 <= 0x7D7E so none in GB 2312 Hanzi mode range" },
|
||||
/* 40*/ { 30, 0, "¡¡", -1, 0, 4, { 0x22 + 0x80, 0x2E + 0x80, 0x22 + 0x80, 0x2E + 0x80 }, "EUC-KR U+00A1 (0xA2AE)" },
|
||||
/* 41*/ { 30, 1, "¡¡", -1, 0, 2, { 0x222E + 0x8080, 0x222E + 0x8080 }, "EUC-KR 0xA2AE in GB 2312 Hanzi mode range" },
|
||||
/* 42*/ { 30, 0, "詰", -1, 0, 2, { 0x7D + 0x80, 0x7E + 0x80 }, "EUC-KR U+8A70 (0xFDFE)" },
|
||||
/* 43*/ { 30, 1, "詰", -1, 0, 2, { 0x7D + 0x80, 0x7E + 0x80 }, "EUC-KR 0xFDFE > 0xF7FE so not in GB 2312 Hanzi mode range" },
|
||||
};
|
||||
|
||||
int data_size = sizeof(data) / sizeof(struct item);
|
||||
@ -238,7 +238,7 @@ static void test_gb2312_utf8_to_eci(int index) {
|
||||
if (ret == 0) {
|
||||
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
|
||||
for (int j = 0; j < (int) ret_length; j++) {
|
||||
assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] %04X != %04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]);
|
||||
assert_equal(gbdata[j], data[i].expected_gbdata[j], "i:%d gbdata[%d] 0x%04X != 0x%04X\n", i, j, gbdata[j], data[i].expected_gbdata[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -241,8 +241,8 @@ static void test_input(int index, int generate, int debug) {
|
||||
/* 80*/ { UNICODE_MODE, 29, -1, "齄", 0, 29, "60 0E 47 65 77 7C 00", "ECI-29 H1 (GB 2312)" },
|
||||
/* 81*/ { UNICODE_MODE, 29, -1, "齄齄", 0, 29, "60 0E 47 65 77 4B 6F 78 00", "ECI-29 H2 (GB 2312)" },
|
||||
/* 82*/ { UNICODE_MODE, 0, -1, "가", ZINT_WARN_USES_ECI, 26, "Warning 60 0D 18 02 75 2C 10 00", "ECI-26 B3 (UTF-8)" },
|
||||
/* 83*/ { UNICODE_MODE, 30, -1, "가", 0, 30, "60 0F 18 01 18 08 20", "ECI-30 B2 (KS X 1001)" },
|
||||
/* 84*/ { UNICODE_MODE, 30, -1, "가가", 0, 30, "60 0F 18 03 18 08 26 02 08 00", "ECI-30 B4 (KS X 1001)" },
|
||||
/* 83*/ { UNICODE_MODE, 30, -1, "가", 0, 30, "60 0F 18 01 58 28 20", "ECI-30 B2 (EUC-KR)" },
|
||||
/* 84*/ { UNICODE_MODE, 30, -1, "가가", 0, 30, "60 0F 18 03 58 28 36 0A 08 00", "ECI-30 B4 (EUC-KR)" },
|
||||
/* 85*/ { UNICODE_MODE, 170, -1, "?", 0, 170, "60 55 0F 77 26 60", "ECI-170 L1 (ASCII invariant)" },
|
||||
/* 86*/ { DATA_MODE, 899, -1, "\200", 0, 899, "63 41 58 00 40 00", "ECI-899 B1 (8-bit binary)" },
|
||||
/* 87*/ { UNICODE_MODE, 900, -1, "é", 0, 900, "63 42 18 01 61 6A 20", "ECI-900 B2 (no conversion)" },
|
||||
|
@ -237,8 +237,8 @@ static void test_input(int index, int generate, int debug) {
|
||||
/* 71*/ { UNICODE_MODE, 29, -1, "齄", -1, 0, 29, "81 D5 BB FF FF 00 00 00 00", "ECI-29 H(2)1 (GB 2312)" },
|
||||
/* 72*/ { UNICODE_MODE, 29, -1, "齄齄", -1, 0, 29, "81 D5 BB FB BF FF F0 00 00", "ECI-29 H(2)2 (GB 2312)" },
|
||||
/* 73*/ { UNICODE_MODE, 0, -1, "가", -1, 0, 0, "70 2B 5E 80 00 00 00 00 00", "H(f)1 (GB 18030)" },
|
||||
/* 74*/ { UNICODE_MODE, 30, -1, "가", -1, 0, 30, "81 E2 03 E7 7F 00 00 00 00", "ECI-30 T2 (KS X 1001)" },
|
||||
/* 75*/ { UNICODE_MODE, 30, -1, "가가", -1, 0, 30, "81 E3 00 21 81 09 81 08 00", "ECI-30 B4 (KS X 1001)" },
|
||||
/* 74*/ { UNICODE_MODE, 30, -1, "가", -1, 0, 30, "81 E3 00 15 85 08 00 00 00", "ECI-30 T2 (EUC-KR)" },
|
||||
/* 75*/ { UNICODE_MODE, 30, -1, "가가", -1, 0, 30, "81 E3 00 25 85 0D 85 08 00", "ECI-30 B4 (EUC-KR)" },
|
||||
/* 76*/ { UNICODE_MODE, 170, -1, "?", -1, 0, 170, "88 0A A2 FB 1F C0 00 00 00", "ECI-170 L1 (ASCII invariant)" },
|
||||
/* 77*/ { DATA_MODE, 899, -1, "\200", -1, 0, 899, "88 38 33 00 0C 00 00 00 00", "ECI-899 B1 (8-bit binary)" },
|
||||
/* 78*/ { UNICODE_MODE, 900, -1, "é", -1, 0, 900, "88 38 43 00 16 1D 48 00 00", "ECI-900 B2 (no conversion)" },
|
||||
|
@ -266,8 +266,8 @@ static void test_qr_input(int index, int generate, int debug) {
|
||||
/*118*/ { UNICODE_MODE, 29, -1, "齄", 0, 29, "71 D4 02 F7 FE 00 EC 11 EC", "ECI-29 B2 (GB 2312)" },
|
||||
/*119*/ { UNICODE_MODE, 29, -1, "齄齄", 0, 29, "71 D4 04 F7 FE F7 FE 00 EC", "ECI-29 B4 (GB 2312)" },
|
||||
/*120*/ { UNICODE_MODE, 0, -1, "가", ZINT_WARN_USES_ECI, 26, "Warning 71 A4 03 EA B0 80 00 EC 11", "ECI-26 B3 (UTF-8)" },
|
||||
/*121*/ { UNICODE_MODE, 30, -1, "가", 0, 30, "71 E4 02 30 21 00 EC 11 EC", "ECI-30 B2 (KS X 1001)" },
|
||||
/*122*/ { UNICODE_MODE, 30, -1, "가가", 0, 30, "71 E4 04 30 21 30 21 00 EC", "ECI-30 B4 (KS X 1001)" },
|
||||
/*121*/ { UNICODE_MODE, 30, -1, "가", 0, 30, "71 E4 02 B0 A1 00 EC 11 EC", "ECI-30 B2 (EUC-KR)" },
|
||||
/*122*/ { UNICODE_MODE, 30, -1, "가가", 0, 30, "71 E4 04 B0 A1 B0 A1 00 EC", "ECI-30 B4 (EUC-KR)" },
|
||||
/*123*/ { UNICODE_MODE, 170, -1, "?", 0, 170, "78 0A A4 01 3F 00 EC 11 EC", "ECI-170 B1 (ASCII invariant)" },
|
||||
/*124*/ { DATA_MODE, 899, -1, "\200", 0, 899, "78 38 34 01 80 00 EC 11 EC", "ECI-899 B1 (8-bit binary)" },
|
||||
/*125*/ { UNICODE_MODE, 900, -1, "é", 0, 900, "78 38 44 02 C3 A9 00 EC 11", "ECI-900 B2 (no conversion)" },
|
||||
|
@ -225,10 +225,10 @@ static void test_sjis_utf8_to_eci(int index) {
|
||||
/* 30*/ { 29, 0, "崂", -1, 0, 2, { 0xE1, 0xC0 }, "GB 2312 U+5D02" },
|
||||
/* 31*/ { 29, 0, "釦", -1, ZINT_ERROR_INVALID_DATA, -1, {}, "GB 18030 U+91E6 not in GB 2312" },
|
||||
/* 32*/ { 29, 1, "崂", -1, 0, 1, { 0xE1C0 }, "GB 2312 in QR Kanji mode range" },
|
||||
/* 33*/ { 30, 0, "¡¡", -1, 0, 4, { 0x22, 0x2E, 0x22, 0x2E }, "KS X 1001 U+00A1" },
|
||||
/* 34*/ { 30, 1, "¡¡", -1, 0, 4, { 0x22, 0x2E, 0x22, 0x2E }, "KS X 1001 outside QR Kanji mode range" },
|
||||
/* 35*/ { 30, 0, "詰", -1, 0, 2, { 0x7D, 0x7E }, "KS X 1001 U+8A70" },
|
||||
/* 36*/ { 30, 1, "詰", -1, 0, 2, { 0x7D, 0x7E }, "KS X 1001 <= 0x7D7E so none in QR Kanji mode range" },
|
||||
/* 33*/ { 30, 0, "¡¡", -1, 0, 4, { 0x22 + 0x80, 0x2E + 0x80, 0x22 + 0x80, 0x2E + 0x80 }, "EUC-KR U+00A1 (0xA2AE)" },
|
||||
/* 34*/ { 30, 1, "¡¡", -1, 0, 4, { 0x22 + 0x80, 0x2E + 0x80, 0x22 + 0x80, 0x2E + 0x80 }, "EUC-KR 0xA2AE outside QR Kanji mode range" },
|
||||
/* 35*/ { 30, 0, "詰", -1, 0, 2, { 0x7D + 0x80, 0x7E + 0x80 }, "EUC-KR U+8A70 (0xFDFE)" },
|
||||
/* 36*/ { 30, 1, "詰", -1, 0, 2, { 0x7D + 0x80, 0x7E + 0x80 }, "EUC-KR > 0xEBBF so not in QR Kanji mode range" },
|
||||
};
|
||||
|
||||
int data_size = sizeof(data) / sizeof(struct item);
|
||||
@ -247,7 +247,7 @@ static void test_sjis_utf8_to_eci(int index) {
|
||||
if (ret == 0) {
|
||||
assert_equal(ret_length, data[i].ret_length, "i:%d ret_length %d != %d\n", i, ret_length, data[i].ret_length);
|
||||
for (int j = 0; j < (int) ret_length; j++) {
|
||||
assert_equal(jisdata[j], data[i].expected_jisdata[j], "i:%d jisdata[%d] %04X != %04X\n", i, j, jisdata[j], data[i].expected_jisdata[j]);
|
||||
assert_equal(jisdata[j], data[i].expected_jisdata[j], "i:%d jisdata[%d] 0x%04X != 0x%04X\n", i, j, jisdata[j], data[i].expected_jisdata[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ static char *s_eci_list[] = {
|
||||
"ascii", /*27: ISO-646:1991 7-bit character set*/
|
||||
"big5", /*28: Big5 (Taiwan) Chinese Character Set*/
|
||||
"euc-cn", /*29: GB (PRC) Chinese Character Set*/
|
||||
"iso2022-kr", /*30: Korean Character Set (KS X 1001:2002)*/
|
||||
"iso2022-kr", /*30: Korean Character Set EUC-KR (KS X 1001:2002)*/
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -560,7 +560,7 @@ ECI Code | Character Encoding Scheme
|
||||
27 | ISO/IEC 646:1991 7-bit character set (ASCII)
|
||||
28 | Big5 (Taiwan) Chinese Character Set
|
||||
29 * | GB (PRC) Chinese Character Set
|
||||
30 | Korean Character Set (KS X 1001:2002)
|
||||
30 | Korean Character Set EUC-KR (KS X 1001:2002)
|
||||
899 | 8-bit binary data
|
||||
------------------------------------------------------------
|
||||
|
||||
|
@ -194,7 +194,7 @@ static void show_eci(void) {
|
||||
" 27: ISO/IEC 646:1991 7-bit character set (ASCII)\n"
|
||||
" 28: Big5 (Taiwan) Chinese Character Set\n"
|
||||
" 29: ** GB (PRC) Chinese Character Set\n"
|
||||
" 30: Korean Character Set (KS X 1001:2002)\n"
|
||||
" 30: Korean Character Set EUC-KR (KS X 1001:2002)\n"
|
||||
"899: 8-bit binary data\n"
|
||||
"** ECI 29 is GB 2312 except for Han Xin, when it is GB 18030\n"
|
||||
);
|
||||
|
@ -519,7 +519,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>30: Korean KS X 1001</string>
|
||||
<string>30: Korean EUC-KR</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
|
Loading…
Reference in New Issue
Block a user