glassechidna / zxing-cpp

ZXing C++ Library
Apache License 2.0
605 stars 436 forks source link

Get raw data from datamatrix code #100

Open goodbooroondook opened 1 year ago

goodbooroondook commented 1 year ago

Hello!

Is it possible to get raw data without any modification from results? after decoding?

For exmaple, original code data: 01086912345678902113234246791707011910X2512061322, data after decoding: ]d201086912345678902113234246791707011910X2512061322.

Yes, this modification happen according standard, but it would be useful to keep information about original data for some tasks.

As I can see, all FNC symbols after first position will be replaced.

while (!done && bits.available() >= 8) { int oneByte = bits.readBits(8); switch (oneByte) { case 0: throw FormatError("invalid 0 code word"); case 129: done = true; break; // Pad -> we are done, ignore the rest of the bits case 230: DecodeC40OrTextSegment(bits, result, Mode::C40); break; case 231: DecodeBase256Segment(bits, result); break; case 232: // FNC1 // Only recognizing an FNC1 as first/second by codeword position (aka symbol character position), not // by decoded character position, i.e. not recognizing a C40/Text encoded FNC1 (which requires a latch // and a shift) if (bits.byteOffset() == firstFNC1Position) result.symbology.modifier = '2'; // GS1 else if (bits.byteOffset() == firstFNC1Position + 1) result.symbology.modifier = '3'; // AIM, note no AIM Application Indicator format defined, ISO 16022:2006 11.2 else result.push_back((char)29); // translate as ASCII 29 <GS> break;

Or I'm missing something?

Best regards