Closed jonMikelGoya closed 1 year ago
To further explain. We see that your parser only allows AI 21 to be the last one because of the regex. We are not very experts in GS1 barcodes but is that compulsory according to the standard for AI 21 to be always the last?
Thanks in advance.
Hi, Jon In your examples AI 21 and AI 37 have variable length data and must be finishing with the "group separator" or FNC1. Default group separator is '\u{001d}' (See GS1 specification). If AI with variable length data the last, the "group separator" is not needed
See https://www.gs1.org/standards/barcodes/application-identifiers/21?lang=en https://www.gs1.org/standards/barcodes/application-identifiers/37?lang=en
correctly
main() {
final String barcode =
'021845678901234237000001201012345678';
//'010845678900006921000000000000000123451000012345678';
final parser = GS1BarcodeParser.defaultParser();
final result = parser.parse(barcode);
print(result);
}
code = Undefined,
data = {
02 (CONTENT): 18456789012342,
37 (COUNT): 00000120,
10 (BATCH/LOT): 12345678,
}
You may define a custom group separator also by using GS1BarcodeParser.configurableParser(
Close issue
Hi, we are having some problems using your library, we are trying to parse some barcodes of some of our products and we are receiving strange errors that we don't understand.
For example we have this barcode: (01)08456789000069(21)00000000000000012345(10)00012345678
That we know that is valid and works but we receive the error: Data format mismatch RegExp: pattern=^21([!-"%-/0-9:-?A-Z_a-z]{0,20})$ flags= for AI 21.
This other barcode: (02)18456789012342(37)00000120(10)12345678 gives the same error.
(With all the cases we always remove the parenthesis before passing the barcode string)
Is your library limited to some barcode types? or maybe the barcode needs some kind of format?
Thanks, Jon.