![xamBarcode Android Encodings.png](images/xamBarcode_Android_Encodings.png)
The QR (Quick Response) barcode symbology is a matrix (or two-dimensional) code, readable by QR scanners, mobile phones with a camera, and smartphones. This barcode symbology is one of the most popular types of two-dimensional barcodes, as its content can be decoded at high speed.
The code consists of an array of black square modules arranged in an overall square pattern, including a unique finder pattern located at three corners of the symbol. Module dimensions are user-specified to enable symbol production by a wide variety of techniques.
The following properties are specific to the XamQRCodeBarcode symbology.
QR Code has an error correction feature to restore the encoded data if the barcode is damaged or dirty. The user can choose from four error correction levels in accordance with the use case which are set through XamQRCodeBarcode control’s ErrorCorrectionLevel property.
In XAML:
<ig:XamQRCodeBarcode
x:Name="Barcode"
Data="QR Code"
ErrorCorrectionLevel="Medium" />
In C#:
XamQRCodeBarcode Barcode = new XamQRCodeBarcode();
Barcode.Data = "QR Code";
Barcode.ErrorCorrectionLevel = QRCodeErrorCorrectionLevel.Medium;
Each size version has a different number of modules (the module refers to the black and white modules that make up the QR code matrix):
Undefined – this size version is specific to the XamQRCodeBarcode and internally calculates the smallest version that accommodates the data;
Version1 - 21x21 modules;
Version40 – 177x177 modules.
The size version of the XamQRCodeBarcode control is set through its SizeVersion property:
In XAML:
<ig:XamQRCodeBarcode
x:Name="Barcode"
Data="Infragistics"
SizeVersion="Version1" />
In C#:
XamQRCodeBarcode Barcode = new XamQRCodeBarcode();
Barcode.Data = "Infragistics";
Barcode.SizeVersion = SizeVersion.Version1;
QR Code is capable of encoding large numbers of characters using compaction depending on the types of the Data characters. The symbology can also encode JIS Kanji characters by setting EncodingMode to Kanji (only Kanji characters are encoded).
When the XamQRCodeBarcode control has set encoding mode to Undefined, the control internally switches between modes in order to achieve the most efficient compaction for the type of the characters’ data.
You can explicitly set the compaction mode for the XamQRCodeBarcode control’s data by its EncodingMode property:
In XAML:
<ig:XamQRCodeBarcode
x:Name="Barcode"
Data="123"
EncodingMode="Numeric" />
In C#:
XamQRCodeBarcode Barcode = new XamQRCodeBarcode();
Barcode.Data = "123";
Barcode.EncodingMode = EncodingMode.Numeric;
The XamQRCodeBarcode control supports ECI – this means that the control can encode data from character sets other than the default one (ISO/IEC 8859-1). The ECI code is set through the XamQRCodeBarcode control’s EciNumber property.
Refer to the table at the bottom of the topic, containing the supported ECI values and their corresponding character sets. Note that when EciNumber is set to -1 (its default value), the character values and assignments are associated with the default ECI and the ECI protocol is not used in the data encoding. Note that the XamQRCodeBarcode control encodes only characters of the specified character set.
Assume that the data to be encoded is in Greek, using character set ISO/IEC 8859-7 (ECI 000009):
In XAML:
<ig:XamQRCodeBarcode x:Name="Barcode"
EciNumber="9"
Data="ΑΒΓΔΕ"
EciHeaderDisplayMode="Show"/>
In C#:
XamQRCodeBarcode Barcode = new XamQRCodeBarcode();
Barcode.EciNumber = 9
Barcode.Data = "ΑΒΓΔΕ";
EciHeaderDisplayMode = HeaderDisplayMode.Show;
FNC1 mode is used to specify the format of the encoded data. You can choose the Gs1 mode to designate that the data is formatted in accordance with the GS1 General Specifications or Industry mode for data formatted in accordance with specific industry application previously agreed upon by AIM Inc. FNC1 mode applies to the entire symbol and is not affected by subsequent mode indicators.
The mode is set through XamQRCodeBarcode control’s Fnc1Mode property.
In XAML:
<ig:XamQRCodeBarcode
x:Name="Barcode"
Fnc1Mode="Gs1"
Data="(15)970331" />
In C#:
XamQRCodeBarcode Barcode = new XamQRCodeBarcode();
Barcode.Fnc1Mode = Fnc1Mode.Gs1;
Barcode.Data = "(15)970331";
The application indicator property value is used when XamQRCodeBarcode control’s Fnc1Mode property is set to Industry. It identifies the relevant specification by AIM Inc.
In XAML:
<ig:XamQRCodeBarcode
x:Name="Barcode"
Data="http://www.infragistics.com" />
In C#:
XamQRCodeBarcode Barcode = new XamQRCodeBarcode();
Barcode.Data = "http://www.infragistics.com";
In XAML:
<ig:XamQRCodeBarcode x:Name="Barcode" Data="愛" EncodingMode="Kanji" />
In C#:
XamQRCodeBarcode Barcode = new XamQRCodeBarcode();
Barcode.Data = "愛";
Barcode.EncodingMode = EncodingMode.Kanji;