How do I put GS / RS / EOT into a PDF417 barcode?

A standard format for structured data is the GS/RS scheme, commonly used on Military Shipment Labels (MIL) among others. Here GS and RS stand for Group Separator (or Selector) and Record Separator (or Selector), respectively. Typically the structure looks like this when used to encode GS1 data:


The individual data elements are separated by GS symbols, the whole structure is enclosed in RS smbols and ended by EOT (End Of Text). Also to identify the format to the scanner / the decoding software the whole string starts with "[)>".

GS, RS and EOT are non-printable ASCII characters, you won't find them on a keyboard. To encode those characters you can use the Tilde Notation with our barcode software. Here, a non-printable character is encoded by using the tilde, followed by the three letter ASCII code of the character. For example, to encode a GS (ASCII code 29) you'd use "~029".

Common non-printable characters:

GS - ~029
RS - ~030
EOT - ~004
TAB - ~009

The sample from above thus becomes:

[)> ~030 05 ~029 <DATA> ~029 <DATA> ~029 <DATA> ~030 ~004

Note: Blanks between items are introduced for readibility, they are not put into the data in real world applications.

Following is a PDF417 barcode that encodes the sample data: