Creating ECI 4, Binary Mode East European QRCodes

SUMMARY

This article explains how to use QRCode Fonts & Encoder 5 product to create QRCodes commonly used in Eastern European countries. It demonstrates how to construct input string and modifier byte to meet special requirements.

This article assume that you understand basic QRCode terms such as ECI, Error Correction Level etc. It is recommended that you read the first chapters of the product manual to get familiar with those concepts.

REQUIREMENTS

Based on support requests, the commonly used QRCdoe format in some East European countries have the following requirements:

  • Version 15

  • Mode: Byte (binary)

  • Error Correction Level: M

  • ECI Value: 000004

  • Encoding: ISO-8859-2

The input text falls completely in ISO-8859-2 (latin2) and must be coded with ECI feature. The Mode must be Binary throughout, which contrary to the QRCode specification (which points out the size optimization should be used at the encodation stage).

To product QRCodes that meet the requirement, you need QRCdoe Fonts & Encoder 5.2 or above.

RESOLUTION

This sections discusses the construction of parameters: input string, error correction level and version.

Input String

When constructing input string, Unicode should not be used because the requirement mandates the use of ECI. The ECI value for ISO-8859-2 is 4 and expressed as ~7000004 in our software. If you are not familiar with the escape method used in our software, read the section "Input Format" of the product manual.

With ECI 4 in place, all characters should be presented with their values under character set ISO-8859-2. For example, Č (Unicode 0x010c) is entered as byte value 200. You can use ~dnnn to escape a character with decimal value nnn. Note that this is not required if the file encoding is ISO-8859-2, but it is more portable.

For example, the input string for PLAČILO RAČUNA - OBROK 1 1604551 is ~7000004PLA~d200ILO RA~d200UNA - OBROK 1 1604551.

Error Correction Level

QRCode support 4 error correction levels: L, M, Q and H. The software use 0, 1, 2, and 3 to represent the 4 levels. The value from EC level M is 1.

Version

Since version 5.2, the Version parameter consists of two bytes. The lowest byte denotes the version number required, and the second lowest serves as modifier byte that modifies encoder behavior (such as enforcing mode requirement).

QR Code has a total of 40 different sizes. Each size is referred as Version, ranged from 1 to 40. The version number is also the value of version. In this case, the value is 15.

To enforce binary mode throughout the symbol, value 4 should be chosen for modifier byte (see the explanation in the manual). The modifier byte is the second lowest byte in Version parameter. Therefore the the value of Version parameter is 0x1000 | 0x0f = 0x100f = 4111.

Putting together

The following scripts is the full formula used to create barcode string in Crystal Reports:

StringVar CompleteBarcodeString:="";
StringVar DataToEncode:= "~7000004PLA~d200ILO RA~d200UNA - OBROK 1 1604551";
NumberVar i:=0;
NumberVar Segments:=
QRCodeEncodeSet(DataToEncode, 4111, 1);
For i:=0 to Segments Do
(
   CompleteBarcodeString := CompleteBarcodeString +
             QRCodeEncodeGet(i);
);
CompleteBarcodeString