#38 Generate wrong DataMatrix barcode


It is suspected that there is problem during encoding of DataMatrix barcode. The generated image is unable to be decoded by barcode scanner.

Below please find an example.


  • Anonymous - 2012-03-01

    Do you have a sample image containing the incorrect barcode?

  • Andy

    Andy - 2012-03-01

    The problem occurs when the input string contains some specific pattern. E.g. uppercase, '>' at some particular place.

    The problem can be reproduced by the demo applet.

  • Anonymous - 2012-03-01

    I can read the barcode just fine using the BarcodeScanner app on my android phone. What happens when you have those '>' characters is a different encoding is used. Perhaps your reader has a problem with the encoding? I had, what I think may be, this same issue and it turned out that my reader was at fault.

    You can run a test here: http://online-barcode-reader.inliteresearch.com/

  • Andy

    Andy - 2012-03-01

    What encoding can be set?

    I am using a real barcode scanner for testing. And it can decode the DataMatrix barcode if the barcode is generated by another tools (same input string).

    And it is weird that it works fine if I change the input string to "<ABCDEFG><ABCDF>"

  • Anonymous - 2012-03-01

    In my case it was EDIFACT encoding. See org.krysalis.barcode4j.datamatrix.DataMatrixHighLevelEncoder.java. I actually turned off EDIFACT encoding myself when I was having a problem and forced it to remain as standard ASCII. This requires modifying the source. If you want more guidance let me know, but not tonight. ;)

  • Andy

    Andy - 2012-03-01

    Thank you very much.

    I tried another longer string. http://online-barcode-reader.inliteresearch.com also decoded wrongly.

    <PATIENT><HospitalCode>SHP</HospitalCode><HospitalName>Evangel Hospital</HospitalName><MRN>HN124344(A)</MRN><EpisodicNo>223456</EpisodicNo><Surname>Chan</Surname><Givenname>Siu Ling</Givenname><AdmissionDate>01-Dec-2010 00:00:00</AdmissionDate><DischargeDate>23-Feb-2012 00:00:00</DischargeDate></PATIENT>


  • Jeremias Märki

    Jeremias Märki - 2012-03-01

    I've looked at your examples. My MetroLogic Focus MS1690 hardware scanner can decode the first one just fine. That one is purely about EDIFACT encoding. I've also verified various deviations from the first example. They were all good and also looked good from the way the codewords are produced.

    While my scanner does decode the big one, the result is wrong. But the problems appear to be starting at a place where EDIFACT is not involved.

    I have to dig deeper here, but right now I don't have the time for it. Maybe I can take another look during the weekend. No promises.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks