LEADTOOLS is able to read any type of data found within a bar code. Be it 1D, 2D, 2D PDF, or QR bar codes. The data can be in ASNI, UNICODE, or some other encoding, such as
Extended Channel Interpretations (ECI) encoding. It could even be a small image (like an Icon)
Once the data is read, it is given to you as buffer of bytes. It is then up to you to determine how to parse the data. If you know the data is in UNICODE, then you know each UNICODE character will be every two bytes within the buffer of data we give you.
If you know the data is Icon image data, then you know you can place the byte buffer in a bitmap and display the data.
If you know the data is ANSI, then you know each byte of the buffer corresponds to an ANSI character. However, in some cases, the ANSI values could represent characters in another encoding. Such is the case for the ECI encoded data.
Extended Channel Interpretations (ECI) encodingYou can determine if the data is ECI encoded by checking the first 10 of the data. In the attached project I use a barcode that has ECI encoded data. The data corresponds to the Greek character set
ISO 8859-7.
When read, you can check the byte buffer we give you for the markers indicating it is encoded in ECI. For the sample image provided the marker will be "]Q2\000009" The "]Q2" tells you the bar code has the ECID encoding. The "\" is a separator, and the "000009" tells you how the rest of the data in the buffer is encoded.
In Windows, you must use the function
MultiByteToWideChar function to covert bytes of data to their UNICODE equivalent to display the characters correctly. The MultiByteToWideChar function takes a value indicating which
code page to use to perform the conversion.
So to perform the conversion, you must map the ECI value to a Microsoft value which tells the MultiByteToWideChar function which code page to use when performing the conversion.
The sample attach provides a mapping for most of the ECI values to a Microsoft values and checks for the presence of the "]Q2" indicator.
Of course there are other indicators to check for as well. This sample is meant to illustrate how this can be done and can be used as a starting point for you to expand on, including other encodings as needed.
UNICODEThis project also shows you how to write UNICODE characters to a QR barcode and then read them back, displaying their glyphs and displaying their actual character code value in hexadecimal.
The C++ Visual Studio 2010 project is in using LEADTOOLS version 18.0.
Travis Montgomery
Senior Sales Engineer