Closed mungewell closed 6 years ago
commit 96a49807006c654959ae18315e161496c27cce04 breaks GS-1/FNC1 encoding.
$ echo -n '+0010030378123456789017130700103033262+3000017' | dmtxwrite -e e -o test.png -G 43
dmtxwrite: Unable to encode message (possibly too large for requested size)
We need to (internally) be able to send '31', however when a user includes it in the barcode text we need to escape back to ASCII to encode it. This could be done with a check for 'non-EDIFACT' characters somewhere around here: https://github.com/dmtx/libdmtx/blob/master/dmtxencodeedifact.c#L28
echo -n '+0010030378123456789017130700103033262+3000017' | dmtxwrite -e e -o test.png -G 43
Well, 68794ea should fix it (as far as I tested). Can you confirm it (so I can tag v0.7.6 on that commit), please?
2nd patch was putting FNC1 when not needed. This should fix it. https://github.com/dmtx/libdmtx/pull/11
'We' probably need to figure out whether specify the encoding means only that encoding, or whether it is more a hint. If the user supplies a character which can not be encoded in specified encoding what should we do...?
If the user includes the '31' (unlatch to ASCCII) character in the input, EDIFACT barcode is corrupted. It should unlatch to ASCII first and then encode character in a different scheme, or at least throw an error.