mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Allow encoding HT FS GS RS and CRLF in code set B
Bug reported by Milton Neil <miltonneal@bigpond.com>
This commit is contained in:
parent
6a69e97dfe
commit
cddf469ac6
@ -614,12 +614,42 @@ int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char sourc
|
||||
}
|
||||
} else {
|
||||
if (datum_b(source, input_position, length)) {
|
||||
codeword_array[array_length] = source[input_position] - 32;
|
||||
array_length++;
|
||||
input_position++;
|
||||
done = 1;
|
||||
if (debug) {
|
||||
printf("C2/2 ");
|
||||
|
||||
if ((source[input_position] >= 32) && (source[input_position] <= 127)) {
|
||||
codeword_array[array_length] = source[input_position] - 32;
|
||||
done = 1;
|
||||
|
||||
} else if (source[input_position] == 13) {
|
||||
/* CR/LF */
|
||||
codeword_array[array_length] = 96;
|
||||
input_position++;
|
||||
done = 1;
|
||||
|
||||
} else if (input_position != 0) {
|
||||
/* HT, FS, GS and RS in the first data position would be interpreted as a macro (see table 2) */
|
||||
switch(source[input_position]) {
|
||||
case 9: // HT
|
||||
codeword_array[array_length] = 97;
|
||||
break;
|
||||
case 28: // FS
|
||||
codeword_array[array_length] = 98;
|
||||
break;
|
||||
case 29: // GS
|
||||
codeword_array[array_length] = 99;
|
||||
break;
|
||||
case 30: // RS
|
||||
codeword_array[array_length] = 100;
|
||||
break;
|
||||
}
|
||||
done = 1;
|
||||
}
|
||||
|
||||
if (done == 1) {
|
||||
array_length++;
|
||||
input_position++;
|
||||
if (debug) {
|
||||
printf("C2/2 ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user