Encoding

By default, all input data is assumed to be encoded in Unicode (UTF-8) format. Many barcode symbologies encode data using Latin-1 (ISO-8851-1open in new window) character encoding, which means the input data will be converted from Unicode to Latin-1 before being put in the symbol. QR Code, Micro QR Code, Han Xin Code, and Grid Matrix standards can encode Chinese or Japanese characters, which are also converted from Unicode.

If characters which can not be encoded using the default character encoding are encountered during render, the Extended Channel Interpolation (ECI) method will be used to encode the data.

Important

Not all barcode readers support ECI mode, so using ECI can sometimes result in unreadable barcodes. If you are using characters beyond those supported by Latin-1, you should check that the resulting barcode can be understood by your target barcode reader.

Extended Channel Interpolation (ECI)

If you are passing in input data from file which is not encoded in UTF-8, you can specify the encoding using the eci option with the appropriate ECI code.

This procedure will add an ECI flag in the barcode data that tells the barcode reader to change character encoding.

Note

A warning message will be generated when ECI codes have been inserted into a symbol.

Available ECI Codes

The following is a list of available ECI codes:

ECI CodeCharacter Encoding Scheme
3ISO-8859-1 - Latin alphabet No. 1 (default)
4ISO-8859-2 - Latin alphabet No. 2
5ISO-8859-3 - Latin alphabet No. 3
6ISO-8859-4 - Latin alphabet No. 4
7ISO-8859-5 - Latin/Cyrillic alphabet
8ISO-8859-6 - Latin/Arabic alphabet
9ISO-8859-7 - Latin/Greek alphabet
10ISO-8859-8 - Latin/Hebrew alphabet
11ISO-8859-9 - Latin alphabet No. 5
12ISO-8859-10 - Latin alphabet No. 6
13ISO-8859-11 - Latin/Thai alphabet
15ISO-8859-13 - Latin alphabet No. 7
16ISO-8859-14 - Latin alphabet No. 8 (Celtic)
17ISO-8859-15 - Latin alphabet No. 9
18ISO-8859-16 - Latin alphabet No. 10
20Shift-Jis (JISX 0208 and JISX 0201) ❖
21Windows-1250 - Latin 2 (Central Europe)
22Windows-1251 - Cyrillic
23Windows-1252 – Latin 1
24Windows-1256 - Arabic
25UCS-2 Unicode (High Order Byte First) ❖
26Unicode (UTF-8)
27ISO-646:1991 7bit Charset
28Big-5 (Taiwan) Chinese Charset ❖
29GB(PRC) Chinese Charset ❖
30Korean Charset (KSX1001:1998) ❖

❖ Note

When using the ECI flag, all input data will be treated as raw binary. This means that any data which is encoded using a multible byte encoding scheme (one other than UTF-8) will not use optimal compression.

It's recomended that data using these schemes are converted to UTF-8 before rendering the SymbologyType.

GS1 Data

GS1 data can be encoded in a number of symbologies. Application identifiers should be enclosed in square brackets ([...]) followed by the data to be encoded.

To encode GS1 data, set the encoding option to EncodingMode.GS1_MODE (see Encoding Modes).

Note

GS1 mode is automatically assumed for EAN-128, DataBar and Composite symbologies but is also available for Code 16k, Data Matrix, QR Code, Aztec Code, DotCode, and QR Code.

HIBC Data

Health Industry Bar Code (HIBC) data may also be encoded in the Code 39, Code 128, Codablock-F, Data Matrix, QR Code, PDF417 and Aztec Code symbologies. Within this mode, the leading + and the check character are automatically added.

Encoding Modes

The way in which the input data is encoded can be set using the encoding property. Valid values are described below.

ValueEffect
DATA_MODEUses full ASCII range interpreted as Latin-1 or binary data.
UNICODE_MODEUses pre-formatted UTF-8 input.
GS1_MODEEncodes GS1 data using FNC1 characters.
WSCAPE_MODEProcess input data for escape sequences.

Values can be accessed using the EncodingMode enumerated type.

Deprecation Notice

Starting in version 2.1.0, the Encoding enum has been renamed to EncodingMode, and Encoding will be removed in the next major release.

Example

createStream({
  symbology: SymbologyType.CODE128,
  encoding: EncodingMode.GS1_MODE
}, '12345')