qr-code

QR code (abbreviated from Quick Response Code) is a type of matrix bar code consisting of black modules (square dots) arranged in a square grid on a white background.

The QR code can be used to encode text and binary data of variable length. It is possible to encode up to 2953 code words. The code value is converted from the XML unicode value to the specified encoding.

By default, the bytes encoded in a QR code image are interpreted as characters from the ISO-8859-1 (Latin 1) encoding. Other encodings can be specified in the encoding attribute and an extended channel interpretations (ECI) code will be inserted if available for the encoding. The code covers issues such as:
  • Is the data compressed? If yes, how?
  • Is the data part of a larger message? If yes, which part?
  • Is the data encoded in a non standard way? If yes, which encoding was used?
An ECI code exists for the following encodings:
  • Cp437 (0,2)
  • ISO-8859-1 (ECI codes 1,3)
  • ISO-8859-2 (ECI code 4)
  • ISO-8859-3 (ECI code 5)
  • ISO-8859-4 (ECI code 6)
  • ISO-8859-5 (ECI code 7)
  • ISO-8859-6 (ECI code 8)
  • ISO-8859-7 (ECI code 9)
  • ISO-8859-8 (ECI code 10)
  • ISO-8859-9 (ECI code 11)
  • ISO-8859-10 (ECI code 12)
  • ISO-8859-11 (ECI code 13)
  • ISO-8859-13 (ECI code 15)
  • ISO-8859-14 (ECI code 16)
  • ISO-8859-15 (ECI code 17)
  • ISO-8859-16 (ECI code 18)
  • Shift_JIS (ECI code 20)
  • Cp1250, windows-1250(ECI code 21)
  • Cp1251, windows-1251(ECI code 22)
  • Cp1252, windows-1252(ECI code 23)
  • Cp1256, windows-1256(ECI code 24)
  • UnicodeBigUnmarked, UTF-16BE, UnicodeBig (ECI code 25)
  • UTF-8 (ECI code 26)
  • US-ASCII (ECI codes 27,170)
  • Big5 (ECI code 28)
  • GB18030, GB2312, EUC_CN, GBK (ECI code 29)
  • EUC-KR (ECI code 30)
The following attributes are used by the qr-code bar code type:
  • errorCorrectionDegree
    • Type: Integer value.

    • The errorCorrectionDegree property specifies the error correction degree.

    • Valid values are in the range of 0 - 3. Higher values make the image more robust (ISO 18004:2006, 6.5.1 defines: 0=~7%, 1=~15%, 2=~25% and 3=~30%).

    • Fails if: Value cannot be parsed as an integer value. Value is not in the range of 0 - 3.

    • Default value: 3

  • encoding
    • Type: Encoding

    • The encoding property sets the encoding for non-ASCII characters in the code value.
    • The following encodings can be set:

      Encoding Type Description
      ISO-8859-1 Use this setting if all characters in codeValue are from this code page. Some scanners or scanner apps interpret the non-ASCII characters non standard (e.g. as Japanese characters). In this case the scanner may have a setting to change the interpretation. If this is not the case then try using "UTF-8" encoding. Please note that for ISO-8859-1 encoding no ECI code is embedded (Use the encoding ISO-8859-15 to force an ECI inclusion.)
      Bytes Use this setting to set the byte values. Literal characters in codeValue are mapped to ISO-8859-1 byte representation and characters not representable in XML documents can be escaped by a backslash ('\') character followed by a 3 digit octal literal. The backslash character itself can be escaped by a sequence of two backslash characters or its octal representation \134 in ISO-8859-1.
      UTF-8 This is the default value and should be used unless the two other options from above are applicable. If a scanner fails to interpret the characters correctly and all character in codeValue are available from a different encoding listed by CharsetInfo, then this encoding should be tried next.
      Any encoding listed by CharsetInfo (e.g. "Shift_JIS", "Big5" or "ISO-8859-8") If all of the option above are not applicable this option should be used. For encodings for which a ECI code exists, the code will be embedded allowing the scanner to change the interpretation accordingly.
      Any encoding listed by CharsetInfo prefixes with the string "RAW-" (e.g. "RAW-Shift_JIS", "RAW-Big5" or "RAW-UTF-8" Some scanners do not recognize ECI codes and expect a specific encoding (other than ISO-8859-1). For this case, this setting should be used.
    • Fails if: Value is not a valid encoding name.

    • Default value: UTF-8

QR code examples

Figure: Hello World: size not specified (default error correction (3))


This figure shows a QR code of Hello World with an unspecified size and an error correction degree setting of 3 (the default).

Figure: Hello World: size not specified (error correction degree (2))


This figure shows a QR code of Hello World with an unspecified size and an error correction degree setting of 2.

Figure: Hello World: size not specified (error correction degree (1))


This figure shows a QR code of Hello World with an unspecified size and an error correction degree setting of 1.

Figure: Hello World: width="3cm"


This figure shows a QR code of Hello World with a specified width of three centimeters.

Figure: http://www.4js.com


This figure shows a QR code example of a web site address: http://www.4js.com.