The following barcodes are not readable ZXing and Scanner
[01]04610044273054[21]g2gsiKr,RFeBP[91]8029[92]2pCgkX8afzBWSyXmjg9T+z5cpVqo7VltiIwbTHAv2T0+BfRaCcmul5dVAzU9C2pmNyC041qMxpbsXAXhual/LA==
[01]04610044273054[21]g2gsiKr,RFeBP[91]8029[92]2pCgkX8afzBWSyXmjg9T+z5cpVqo7VltiIwbTHAv2T0+BfRaCcmul5dVAzU9C2pmNyC041qMxpbsXAXhual/LA==
3-line barcode
[01]04610044273252[21]LRFX)k<C7ApWJ[91]003A[92]
K8rNAqdvjmdxsmCVuj3FhaoNzQuq7Uff0sHXfz1TT/
doiMaGQqNF+VPwMvwVbm1fxjzuDt6jxLCcc8o/tqbEDA==
other barcode
[01]04610044273054[21]g2gsiKr,RFeBP[91]8029[92]
2pCgkX8afzBWSyXmjg9T+z5cpVqo7VltiIwbTHAv2T0
+BfRaCcmul5dVAzU9C2pmNyC041qMxpbsXAXhual/LA==
Old DataMatrixEncoder.cs generate good barcode.
Last edit: Sergey Smirnov 2020-03-03
Zxingb Error 0
void ProcessRemainingData(
....
case EDIFACT:
....
if (dataBytesLeft == 1)
{
dataStream.Add((byte)((processBuffer[0] << 2) + ((31 & 0x30) >> 4)));
dataStream.Add((byte)((31 & 0x0f) << 4));
dataStream.Add((byte)0);
Maybe you don't need to add the last element
ZXing https://github.com/micjahn/ZXing.Net/blob/master/Source/lib/datamatrix/decoder/DecodedBitStreamParser.cs
///
<summary>/// See ISO 16022:2006, 5.2.8 and Annex C Table C.3
/// </summary>
private static bool decodeEdifactSegment(BitSource bits, StringBuilder result)
{
while (bits.available() > 16)
{
for (int i = 0; i < 4; i++)
{
int edifactValue = bits.readBits(6);
if (edifactValue == 31)
{
int bitsLeft = 8 - bits.BitOffset;
if (bitsLeft != 8)
{
bits.readBits(bitsLeft);
}
return true; //!!!! the next character is 0
}
if ((edifactValue & 32) == 0)
{
edifactValue |= 64;
}
result.Append((char)edifactValue);
}
if (bits.available() <= 0)
{
return true;
}
}
return true;
}
Then switch to reading ASCII ENCODE
oneByte = bits.readBits(8);
if (oneByte == 0)
{
break;// error
}
Last edit: Sergey Smirnov 2020-03-04
https://github.com/micjahn/ZXing.Net/blob/master/Source/lib/datamatrix/encoder/EdifactEncoder.cs
private static String encodeToCodewords(StringBuilder sb, int startPos)
Hello Sergey
I have uploaded a patched version on DatamatrixEncoder.cs.
You can download it from the repository.
This now generates and scans correctly. I tested this with your sample data.
Let me me if you have any more problems.
Milton
Thank you very much! I'll check it out in a week. Now we are working at home because of the coronavirus! Be healthy!
Hello, Milton!
What was the exact reason of this bug? How can I find which strings caused this behavior of the library?
I'll explain. I work for company that has a huge amount of barcodes for special labels used in its production process. And we want to find which barcodes was generated incorrectly to reissue the labels with them. It's impossible to reissue all labels, so we want to replace only defecive labels.
Thank you.
For example, some more strings which caused unreadable barcodes.
I can't see, what they have in common...
Hello Vadim
As you may know the ZintNet library is a port of the C Zint library. So a lot of code was converted from C to C#. Some of the issues were typing errors in converting the code. Some were bug fixes in the original Zint C code which I hadn't applied to the ZintNet code.
In my code I found that an ECI was being inadvertently added the beginning of the symbol, which shouldn't have affected scanning of the barcode, as all you lastest samples scanned correctly with my scanner.
I'll look deeper into this and post a patch for you to try as soon as I complete my test.
Milton
Hello Vadim
I've uploaded a code fix for DataMatrix.cs to the repository.
You can download it into your project. Let me know how you get on.
Cheers Milton
Hello Milton
All our existing labels generated correctly, but we found a new string which causes unreadable barcode:
[01]04680065199121[21]SOIP5XD3XtmjV[91]002A[92]WSV7Nv2lqcL3YH/Fm5hjs4klyF7LjRjojuu2Jhvga/T4ZtH2rJg6WSvn6GsIO7c6VR+Mae8VpqyulBpX/GRP+Q==
I hope it will help to find another reason.
Thank you.
Vadim
Can you try the lastest patch for me.
Thanks Milton
Hello, Milton!
It seems that it's ok now
010468006519912121SOIP5XD3XtmjV 91002A 92WSV7Nv2lqcL3YH/Fm5hjs4klyF7LjRjojuu2Jhvga/T4ZtH2rJg6WSvn6GsIO7c6VR+Mae8VpqyulBpX/GRP+Q==
I'll rebuild my application with your latest patch a bit later and check it once again.
Thank you!
Hello Milton!
I checked a big list of our barcodes with the new patch, they all generated correct now.
(I wrote a small application for barcode checking. It uses a handheld barcode scanner in automatic mode. A list of source string is loaded into the app and it displays generated barcodes one by one, waiting a response from scanner. When response is receved, next barcode is shown, otherwise the app shows an error message.)
Thank you again.
Hi Vadim
Thanks for the feedback. I've re-check all the dm code and all appears correct. Hopefully we have sovled all the issues. :)