Open akucherov opened 4 years ago
I assume you mean the gs1datamatrix
encoder. According to:
https://www.gs1.org/standards/barcodes/application-identifiers/21?lang=en
Parentheses (0x28, 0x29) are legal in serial numbers. It may not be what you expect, but it is correct.
Yes, I mean 0x28, 0x29, some combinations of these symbols breaks the gs1datamatrix
encoder.
Please click at the following link http://bwipjs-api.metafloor.com/?bcid=gs1datamatrix&text=(01)03348901294669(21)LUeq((C6CkbMO&scale=2, you will get the exception:
Error: array-marker-not-found $a@http://bwip-js.metafloor.com/demo/dist/bwip-js-min.js:41:189 http://bwip-js.metafloor.com/demo/dist/bwip-js-min.js:41:683866 http://bwip-js.metafloor.com/demo/dist/bwip-js-min.js:41:716607 Render@http://bwip-js.metafloor.com/demo/dist/bwip-js-min.js:41:718585 ToCanvas@http://bwip-js.metafloor.com/demo/dist/bwip-js-min.js:41:717012 render@http://bwip-js.metafloor.com/demo/demo.html:156:18
The following link generates an image http://bwipjs-api.metafloor.com/?bcid=gs1datamatrix&text=(01)03348901294669(21)LUeq(C6C)kbMO&scale=2 but the result is not scanned as a GS1 DataMatrix and the serial number is different. I used "Scandit" app for testing
It was not clear in your original post that an error was occurring. I tried your malformed string in the online BWIPP demo, and it is giving a similar type of error. I don't know if @terryburton will consider this a bug or not as you are clearly providing a nonsensical input string. Hopefully he will join this discussion with a more authoritative response.
Unfortunately these 2 codes from a real project and there are correct DM images for them if another encoder is used:
https://www.kucherov.net/dm2.gif, https://www.kucherov.net/dm1.gif
So I would like to get same images using bwip-js, I hope @terryburton give us his authoritative opinion.
@akucherov: Since this isn't resolved yet, you may want to consider using the general datamatrix encoder and manually create the GS1 format. From the BWIPP reference at:
https://github.com/bwipp/postscriptbarcode/wiki/Data-Matrix
Use encoder datamatrix
with the option parsefnc
and insert ^FNC1
before each application id (and remove the parentheses around the AIs). From your examples:
Hope that helps.
Sorry. I missed this up until now. I need to rework the parsing to allow escaping of characters within the GS1 format.
I've noted it here: https://github.com/bwipp/postscriptbarcode/issues/61
The solution provided in the previous comment is the best you can do for now.
Round brackets are legal characters for SN (AI 21) but if there are 2 left round brackets or a couple of brackets then a result DataMatrix is incorrect:
(01)03348901294669(21)LUeq(C6)CkbMO (01)03348901294669(21)LUeq((C6CkbMO