I get my DataMatrix code using the following line:
BitMatrix bitMatrix = new DataMatrixWriter().encode(dmie.preEncodeBarcode(dataToEncode), BarcodeFormat.DATA_MATRIX, 50, 50, null);
The input string I get contains "FNC1" (just as plain characters in the string) to mark the end of a dynamic field, and in total the string has 4 different GS1 DataMatrix Application Identifiers and their respective values.
What preEncodeBarcode() does is to replace "FNC1" with <GS>, like so:
input = input.replaceAll("FNC1", new String(new byte[] {0x1d}));
Since otherwise I simply get "FNC1910005FNC1230202[...]" encoded in the DataMatrix, while what I want is of course <GS> instead of the text "FNC1".
However, when replacing FNC1 with <GS> (I've tried using '\u001c' as well), I get the attached very strange double-DM-code instead of a normal one. Only if I skip replacing FNC1 with <GS> do I get a proper one.
Any idea to get a proper DataMatrix code based on my <GS>-containing String?
(PS. I am using the code found here: http://stackoverflow.com/questions/22766017/datamatrix-encoding-with-zxing-only-generates-14px-bitmap?answertab=votes#tab-top to scale the DataMatrix to the size I want, but it's zxing that gives the wrong output from the start.)
--
You received this message because you are subscribed to the Google Groups "zxing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zxing+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
This indeed, seems to have been the missing piece of the puzzle, as I now get exactly what I expect.
However, on the topic of GS1 and FNC1:
According to the GS1 standard, as far as I'm able to understand it, a first or second position FNC1 should be coded as "[d2" (although I am still uncertain if it should be encoded as these three characters or if it should encoded as another strange ASCII symbol?), while any consecutive ones should be encoded as the ASCII character <GS>.
Some libraries I've tried have automatically converted and encoded a string with parentheses around the application identifiers, as such: (91)00001(23)738494[...]. If I scan that with my phone I can't see any "[d2" (although it could still be there?), but the <GS> show up as spaces.
Seemingly irrespectively of how much I read about it, I can't seem to find a straight answer concerning how to handle the initial and consecutive FNC1's when encoding DataMatrix with zxing. Would you be able to enlighten me?