13

I have searched many a page on wikipedia, the official GS1 specifications, but have yet to find a definite answer to the question

What is the actual HEX / binary value of the GS1 FNC1 character?

There is much information about how to use the GS1 identifiers, how to print the barcodes with ZPL and how to encode the FNC1, but I want to know the actual HEX value of that character.

Terry Burton
  • 2,801
  • 1
  • 29
  • 41
F.P
  • 17,421
  • 34
  • 123
  • 189

2 Answers2

31

The special function characters such as FNC1 through FNC4 belong to the class of "non-data characters" that can be encoded within various barcode symbologies but with do not have any direct ASCII representation in the decoded data stream. Each symbology that supports such characters has a different scheme for encoding them in its internal representation quite distinct from any byte-orientated character data.

The FNC characters serve both as flag characters (indicating something special to the reader) and as formatting characters (modifying the meaning of the encoded data). As such they are not intended to be transmitted directly in the data received by the host system from a basic barcode reader, although in both cases they may have an "effect" on the transmitted message.

The usual purpose of each of the FNC characters are as follows:

  • FNC1 - Structured Data flag character indicating GS1 and AIM formatting AND group separator formatting character, amongst other uses.
  • FNC2 - Message Append flag character for buffering the data in groups of symbols for a single read.
  • FNC3 - Reader Programming flag character for device configuration purposes.
  • FNC4 - Extended ASCII formatting character for encoding characters with ordinals 128-255.

Be aware that they may not all be available in certain barcode symbologies and may even be specified in different, non-typical or overloaded ways.

Encoding an FNC character in a symbol's internal data is accomplished via an "escape mechanism" that is specific to the encoding software. Each library has a different way of accepting these non-data characters within their input. For example, to use FNC1 in its typical GS1 structured data role for the data "(01)00312345678906(21)123456789012(30)0144" you might see the FNC1 characters escaped as {FNC1} so that the input looks like {FNC1}010031234567890621123456789012{FNC1}300144.

Some libraries will even use a set of regular or extended ASCII characters as placeholders for the FNC characters, but these are arbitrary representations and it is a mistake to consider them to be actual ASCII values for these non-data characters.

Upon scanning a barcode the symbol's internal data is typically decoded then transmitted to the host over a basic channel (e.g. keyboard wedge) as a sequence of bytes to be interpreted according to the Latin-1 character encoding. The FNC characters cannot be represented in such a manner and are excluded from the data stream, however their formatting effect on the data remains.

For instance, the standards for most symbologies specify that when an FNC1 character is being used in its role as a field separator in data conforming to GS1 Application Identifier Standard Format it should be decoded and transmitted as GS (ASCII 29). Explicitly stated, the formatting effect of a FNC1 character used as a GS1 Application Identifier separator is to place a GS character at the end of the variable-length field. But in other roles (such as when FNC1 is used in "first/second position" as a flag character and with non-GS1 formatted data) there is no formatting effect on the carried data and therefore no ASCII representation during decoding.

Another instance of the special function characters having a formatting effect on the data is with symbologies that use FNC4 to extend their reach from 7-bit ASCII into extended ASCII as described in this answer.

A subtle technical point is that the data transferred to the host is often prefixed with a short symbol indicator header known as a "symbology identifier" which denotes the type and usage of the symbol from which the data is being read. This is often modified by the presence of otherwise invisible flag characters within the symbol data, for example to indicate the presence of GS1 formatted data with "FNC1 in first" or to indicate reader programming mode when FNC3 appears anywhere in the symbol. The details are symbology specific.

Aside: In addition to FNC non-data characters, there are other non-data characters commonly supported by barcode symbologies that have no direct ASCII representation but affect the overall message. These include macro characters (that wrap the message data in a data character "envelope"), and ECI indicators that require the use of a transmission protocol beyond the typical "basic channel" mode but which enable the use of extended character sets amongst other enhancements.

Terry Burton
  • 2,801
  • 1
  • 29
  • 41
  • Interesting. But how then can a barcode encoded in one manner be read by a system correctly as GS1 if said system does not know exactly how the FNC1 was encoded by the delivering system? You go into detail about the decoding process, what about the encoding process? Suppose I am writing a system that delivers GS1 barcodes, what value am I supposed to use for FNC1 when producing such data? Where did you get the information regarding the de/encoding as ASCII 29 / GS? – F.P Jul 10 '15 at 06:15
  • 1
    I've expanded the answer to deal with encoding. Regarding the source of my information, almost every ISO barcode specification since ISO/IEC 15417 (Code 128) contains something to the effect of "When FNC1 is used in the first or second position it shall not be represented in the transmitted message ... FNC1 in the third or subsequent character position is transmitted as the control character GS (value 29)." (ISO/IEC 15417:2007 appendix B.4) You can see multiple references to FNC1 decoding in the GS1 General Specifications which are freely available. – Terry Burton Jul 10 '15 at 10:56
  • Very concise and useful information. Much better than anything I found on the internet so far. Thank you very much. – F.P Jul 10 '15 at 11:39
1

Important is to know (and to setup a scanner properly) that the FNC1 character at the first position is translated to a symbology identifier according ISO/IEC 15424. The modifier m of the symbology identifier shows if there was a FNC1 or not. If this is not done the application cannot see anymore if a GS1 Structure was intended or not. Other structures are identified by e.g. Macro 06 in a data matrix code (ISO/IEC 16022, ISO/IEC 15434). Its required to figure our the difference to take the correct action to process the data.