mirror of
https://git.code.sf.net/p/zint/code
synced 2026-06-09 23:23:36 +00:00
Add convenience API funcs ZBarcode_UTF8_To_ECI() and
`ZBarcode_Dest_Len_ECI()`, primarily for ZXingC++ but also useful in general
This commit is contained in:
@@ -647,6 +647,19 @@ static const unsigned short int windows_1256[] = {
|
||||
0x064b, 0x064c, 0x064d, 0x064e, 0x00f4, 0x064f, 0x0650, 0x00f7, 0x0651, 0x00f9, 0x0652, 0x00fb, 0x00fc, 0x200e, 0x200f, 0x06d2
|
||||
};
|
||||
|
||||
/* Taken from https://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/CP437.TXT */
|
||||
|
||||
static const unsigned short int cp437[] = {
|
||||
0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7, 0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5,
|
||||
0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9, 0x00ff, 0x00d6, 0x00dc, 0x00a2, 0x00a3, 0x00a5, 0x20a7, 0x0192,
|
||||
0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba, 0x00bf, 0x2310, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255d, 0x255c, 0x255b, 0x2510,
|
||||
0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x255e, 0x255f, 0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x2567,
|
||||
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256b, 0x256a, 0x2518, 0x250c, 0x2588, 0x2584, 0x258c, 0x2590, 0x2580,
|
||||
0x03b1, 0x00df, 0x0393, 0x03c0, 0x03a3, 0x03c3, 0x00b5, 0x03c4, 0x03a6, 0x0398, 0x03a9, 0x03b4, 0x221e, 0x03c6, 0x03b5, 0x2229,
|
||||
0x2261, 0x00b1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00f7, 0x2248, 0x00b0, 0x2219, 0x00b7, 0x221a, 0x207f, 0x00b2, 0x25a0, 0x00a0
|
||||
};
|
||||
|
||||
static void test_utf8_to_eci_sb(const testCtx *const p_ctx) {
|
||||
|
||||
struct item {
|
||||
@@ -674,6 +687,7 @@ static void test_utf8_to_eci_sb(const testCtx *const p_ctx) {
|
||||
/* 16*/ { 22, windows_1251 },
|
||||
/* 17*/ { 23, windows_1252 },
|
||||
/* 18*/ { 24, windows_1256 },
|
||||
/* 19*/ { 2, cp437 },
|
||||
};
|
||||
int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@@ -749,8 +763,8 @@ static void test_utf8_to_eci_ascii(const testCtx *const p_ctx) {
|
||||
/* 16*/ { 170, "~", -1, ZINT_ERROR_INVALID_DATA },
|
||||
/* 17*/ { 170, "\302\200", -1, ZINT_ERROR_INVALID_DATA },
|
||||
/* 18*/ { 170, "~", -1, ZINT_ERROR_INVALID_DATA },
|
||||
/* 19*/ { 1, "A", -1, ZINT_ERROR_INVALID_DATA },
|
||||
/* 20*/ { 2, "A", -1, ZINT_ERROR_INVALID_DATA },
|
||||
/* 19*/ { 1, "A", -1, 0 }, /* Now succeeds (maps to ISO/ECI 8859-1 for libzueci compatibility) */
|
||||
/* 20*/ { 2, "A", -1, 0 }, /* Now succeeds (maps to CP437 for libzueci compatibility) */
|
||||
/* 21*/ { 14, "A", -1, ZINT_ERROR_INVALID_DATA },
|
||||
/* 22*/ { 19, "A", -1, ZINT_ERROR_INVALID_DATA },
|
||||
/* 23*/ { 26, "A", -1, ZINT_ERROR_INVALID_DATA },
|
||||
|
||||
Reference in New Issue
Block a user