Hi,
When digitize bar codes, e.g., from loyalty cards onto a smartphone, we want to scan the code and later be able to display the exact same code on the screen. This is what the app
Catima does.
For Code 128 bar codes three different sub-types/code sets can be used (A/B/C). The MultiFormatOneDReader/Code128Reader decodes barcodes to a string and also returns the raw data bytes (containing code set information). The OneDimensionalCodeWriter/Code128Writer encodes bar codes from strings. I couldn't find a way to generate a bar code from the raw data. When generating a bar code from a string, the Code128Writer determins the best code set to use on its own (
in chooseCode(..)).
A problem arises (
see here) when the code set that is used by the original bar code is not the "best" code set that could be used by the encoder. For example the original bar code might contain only digits, but uses an encoding that allows for characters as well (code set B). The Code128Writer will recognize that the string contains only digits and use the code set for only digits (code set C). This way the resulting bar code will contain the same data, but it will be encoded differently. We have to assume that some card reader only support specific code sets, so these bar codes will be unusable. This is also undetectable because the decisions on the code set (or raw output bytes) are not available to the caller.
Is there a way to make this work? Maybe a hint for the writer to force a specific code set? Or some kind of RawCodeWriter, which will generate bar codes from the raw data that was read. Or a way to access the raw bytes of the writer.
I hope somebody has an idea how we can make this work. Thank you for your time!
Gero