mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Allow explicit ECI 3
Setting ECI to 3 now causes Zint to include ECI 3 in symbol, and allows entry of data formatted in ISO 8859_1 Fixes #127 requested by Harald Oehlmann
This commit is contained in:
parent
ff2ceea361
commit
15ae99ee11
@ -529,7 +529,7 @@ static int aztec_text_process(const unsigned char source[], const size_t src_len
|
||||
bin_append(0, 3, binary_string); // FLG(0)
|
||||
}
|
||||
|
||||
if (eci != 3) {
|
||||
if (eci != 0) {
|
||||
bin_append(0, 5, binary_string); // P/S
|
||||
bin_append(0, 5, binary_string); // FLG(n)
|
||||
if (eci < 10) {
|
||||
|
@ -581,7 +581,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
|
||||
}
|
||||
}
|
||||
|
||||
if (symbol->eci > 3) {
|
||||
if (symbol->eci > 0) {
|
||||
/* Encode ECI numbers according to Table 6 */
|
||||
target[tp] = 241; /* ECI Character */
|
||||
tp++;
|
||||
|
@ -486,7 +486,7 @@ int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char sourc
|
||||
}
|
||||
}
|
||||
|
||||
if (symbol->eci > 3) {
|
||||
if (symbol->eci > 0) {
|
||||
codeword_array[array_length] = 108; // FNC2
|
||||
array_length++;
|
||||
if (symbol->eci <= 39) {
|
||||
|
@ -366,7 +366,7 @@ static int gm_encode(int gbdata[], const size_t length, char binary[],const int
|
||||
bin_append(10, 4, binary); /* FNC3 - Reader Initialisation */
|
||||
}
|
||||
|
||||
if (eci != 3) {
|
||||
if (eci != 0) {
|
||||
/* ECI assignment according to Table 8 */
|
||||
bin_append(12, 4, binary); /* ECI */
|
||||
if (eci <= 1023) {
|
||||
@ -1021,7 +1021,7 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], size_t
|
||||
word[i] = 0;
|
||||
}
|
||||
|
||||
if ((symbol->input_mode == DATA_MODE) || (symbol->eci != 3)) {
|
||||
if ((symbol->input_mode == DATA_MODE) || (symbol->eci != 0)) {
|
||||
for (i = 0; i < length; i++) {
|
||||
gbdata[i] = (int) source[i];
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ static int calculate_binlength(char mode[], int source[], const size_t length, i
|
||||
int est_binlen = 0;
|
||||
int submode = 1;
|
||||
|
||||
if (eci != 3) {
|
||||
if (eci != 0) {
|
||||
est_binlen += 12;
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ static void calculate_binary(char binary[], char mode[], int source[], const siz
|
||||
int glyph;
|
||||
int submode;
|
||||
|
||||
if (eci != 3) {
|
||||
if (eci != 0) {
|
||||
/* Encoding ECI assignment number, according to Table 5 */
|
||||
bin_append(8, 4, binary); // ECI
|
||||
if (eci <= 127) {
|
||||
@ -1249,7 +1249,7 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||
unsigned char *grid;
|
||||
#endif
|
||||
|
||||
if ((symbol->input_mode == DATA_MODE) || (symbol->eci != 3)) {
|
||||
if ((symbol->input_mode == DATA_MODE) || (symbol->eci != 0)) {
|
||||
for (i = 0; i < length; i++) {
|
||||
gbdata[i] = (int) source[i];
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ struct zint_symbol *ZBarcode_Create() {
|
||||
symbol->bitmap = NULL;
|
||||
symbol->bitmap_width = 0;
|
||||
symbol->bitmap_height = 0;
|
||||
symbol->eci = 3;
|
||||
symbol->eci = 0; // Default 0 uses ECI 3
|
||||
symbol->dot_size = 4.0 / 5.0;
|
||||
symbol->debug = 0;
|
||||
return symbol;
|
||||
@ -1144,12 +1144,12 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
||||
error_buffer = error_number;
|
||||
}
|
||||
|
||||
if ((!(supports_eci(symbol->symbology))) && (symbol->eci != 3)) {
|
||||
if ((!(supports_eci(symbol->symbology))) && (symbol->eci != 0)) {
|
||||
strcpy(symbol->errtxt, "217: Symbology does not support ECI switching");
|
||||
error_number = ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if ((symbol->eci < 3) || (symbol->eci > 999999)) {
|
||||
if ((symbol->eci < 0) || (symbol->eci == 1) || (symbol->eci == 2) || (symbol->eci > 999999)) {
|
||||
strcpy(symbol->errtxt, "218: Invalid ECI mode");
|
||||
error_number = ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
@ -1192,7 +1192,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
||||
input_mode = DATA_MODE;
|
||||
}
|
||||
|
||||
if ((symbol->eci != 3) && (symbol->eci != 26)) {
|
||||
if ((symbol->eci != 0) && (symbol->eci != 26)) {
|
||||
input_mode = DATA_MODE;
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,7 @@ int maxi_text_process(int mode, unsigned char source[], int length, int eci) {
|
||||
|
||||
/* Insert ECI at the beginning of message if needed */
|
||||
/* Encode ECI assignment numbers according to table 3 */
|
||||
if (eci != 3) {
|
||||
if (eci != 0) {
|
||||
maxi_bump(set, character, 0);
|
||||
character[0] = 27; // ECI
|
||||
if (eci <= 31) {
|
||||
|
@ -606,7 +606,7 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size
|
||||
mclength++;
|
||||
}
|
||||
|
||||
if (symbol->eci != 3) {
|
||||
if (symbol->eci != 0) {
|
||||
/* Encoding ECI assignment number, according to Table 8 */
|
||||
if (symbol->eci <= 899) {
|
||||
chainemc[mclength] = 927; /* ECI */
|
||||
@ -956,7 +956,7 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if (symbol->eci != 3) {
|
||||
if (symbol->eci != 0) {
|
||||
/* Encoding ECI assignment number, according to Table 8 */
|
||||
if (symbol->eci <= 899) {
|
||||
chainemc[mclength] = 927; /* ECI */
|
||||
|
@ -166,7 +166,7 @@ static void qr_binary(int datastream[], const int version, const int target_binl
|
||||
strcat(binary, "0101"); /* FNC1 */
|
||||
}
|
||||
|
||||
if (eci != 3) {
|
||||
if (eci != 0) {
|
||||
strcat(binary, "0111"); /* ECI (Table 4) */
|
||||
if (eci <= 127) {
|
||||
bin_append(eci, 8, binary); /* 000000 to 000127 */
|
||||
@ -1338,7 +1338,7 @@ static int getBinaryLength(const int version,char inputMode[],const int inputDat
|
||||
count += 4;
|
||||
}
|
||||
|
||||
if (eci != 3) {
|
||||
if (eci != 0) {
|
||||
count += 12;
|
||||
}
|
||||
|
||||
@ -1425,7 +1425,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||
|
||||
gs1 = (symbol->input_mode == GS1_MODE);
|
||||
|
||||
if ((symbol->input_mode == DATA_MODE) || (symbol->eci != 3)) {
|
||||
if ((symbol->input_mode == DATA_MODE) || (symbol->eci != 0)) {
|
||||
for (i = 0; i < length; i++) {
|
||||
jisdata[i] = (int) source[i];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user