I have some data extracted from a GS1 barcode (be it GS1 DataMatrix, GS1 QR Code, GS1 DataBar or GS1-128) that is notionally in GS1 Application Identifier, however the FNC1 separator characters (that are expected to be transmitted as GS characters) are omitted.
Here is the incorrectly extracted data (missing GS characters that represent the barcode message's FNC1 separators) that I wish to parse into AI values:
01012345678912311700112210123421555666777
The intended extraction is as follows (masked for privacy)
(01) 01234567891231
(17) 001122
(10) 1234
(21) 555666777
However according to this notice (page 2) and elsewhere Application Identifiers are defined to either have "predefined fixed length", "fixed length" or "variable length" values.
For example:
- (00) has a predefined fixed length of 18 characters, and does not require FNC1 termination.
- (01) has a predefined fixed length of 14 characters, and does not require FNC1 termination.
- (21) has a variable length up to 20 characters, and therefore does require FNC1 termination.
- (7001) has a fixed length of 13 characters, but is not in the "predefined fixed-length set of AIs" and therefore does require FNC1 termination.
How can I possibly implement a parser for GS1 data that is missing the variable-length field separators?