Can GS1 compatible QR-Codes be created that contain more then just the leading FNC1?

138 views
Skip to first unread message

Alex Geller

unread,
Sep 20, 2021, 9:48:45 AM9/20/21
to zxing
I am asking the question because I am not managing to do so. I manage to insert the initial FNC1 (named FNC1_FIRST_POSITION in the source) by setting the hint EncodeHintType.GS1_FORMAT but how do I encode a delimiting FNC1?
Looking at the source code of the Encoder (https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java) I conclude that it isn't possible but perhaps someone can check that my conclusions is correct. 
I conclude that it isn't possible for the following reason:
It seems that delimiting FNC1s requires a special mode (Mode FNC1_SECOND_POSITION) so that the encoder needs to do mode changes when it encodes the input string.
The code in the method Encoder.encode() however does not seem to change the encoding mode. Instead it computes the mode in line 90 to be one of the four options KANJI, BYTE, ALPHANUMERIC or NUMERIC and the encodes all data in the mode.

Alex Geller

unread,
Sep 24, 2021, 4:27:05 AM9/24/21
to zxing
The answer is no because QR-Codes with more than one FNC1 are not GS1 compatible. In that respect GS1-QR-Code is an exception to the other GS1 bar codes that support variable length AIs like GS1-128 and GS1 DataMatrix. Instead one should encode the AI delimiters for QR-Code either with GS (ASCII 29 decimal) or '%' (ASCII 37 decimal).

From the GS1 general specification (https://www.gs1.org/docs/barcodes/GS1_General_Specifications.pdf):
7.8.3 The separator character and its value
In GS1-128 symbology: The Function 1 Symbol Character (FNC1) SHOULD be the separator
character, and the control character <GS> (ASCII value 29 (decimal), 1D (hexadecimal)) may be an
alternative.
In GS1 DataMatrix and GS1 DotCode symbology: The Function 1 Symbol Character (FNC1) or the
control character <GS> SHALL be the separator character.
In GS1 QR Code symbology: The control character <GS> or the character ‘%’ (ASCII value 37
(decimal), 25 (hexadecimal)) SHALL be the separator character.
In GS1 DataBar and GS1 Composite symbology: The Function 1 Symbol Character (FNC1) SHALL be
the separator character.
The value of the decoded separator character transmitted in the decoded data string is always
control character <GS> (ASCII value 29 (decimal), 1D (hexadecimal)). It is important to note that
some receiving systems may convert/interpret the control character <GS> as something other than
ASCII value 29 (decimal), 1D (hexadecimal).
All element strings not included in the predefined table shown in figure 7.8.4-2 MUST be separated
by a separator character when followed by another element string in a single barcode.

Sorry for the bother

Reply all
Reply to author
Forward
0 new messages