code-128
Details on the code-128 bar code type.
Code 128 can be used to encode ASCII text of variable length. For this purpose characters can be selected from three character sets, each containing 106 characters. Table 1 lists the available characters in the character sets A, B and C.
Reference Number | Character Set A | Character Set B | Character Set C |
---|---|---|---|
0 | space | space | 00 |
1 | ! | ! | 01 |
2 | " | " | 02 |
3 | # | # | 03 |
4 | $ | $ | 04 |
5 | % | % | 05 |
6 | & | & | 06 |
7 | ' | ' | 07 |
8 | ( | ( | 08 |
9 | ) | ) | 09 |
10 | * | * | 10 |
11 | + | + | 11 |
12 | , | , | 12 |
13 | - | - | 13 |
14 | . | . | 14 |
15 | / | / | 15 |
16 | 0 | 0 | 16 |
17 | 1 | 1 | 17 |
18 | 2 | 2 | 18 |
19 | 3 | 3 | 19 |
20 | 4 | 4 | 20 |
21 | 5 | 5 | 21 |
22 | 6 | 6 | 22 |
23 | 7 | 7 | 23 |
24 | 8 | 8 | 24 |
25 | 9 | 9 | 25 |
26 | : | : | 26 |
27 | ; | ; | 27 |
28 | < | < | 28 |
29 | = | = | 29 |
30 | > | > | 30 |
31 | ? | ? | 31 |
32 | @ | @ | 32 |
33 | A | A | 33 |
34 | B | B | 34 |
35 | C | C | 35 |
36 | D | D | 36 |
37 | E | E | 37 |
38 | F | F | 38 |
39 | G | G | 39 |
40 | H | H | 40 |
41 | I | I | 41 |
42 | J | J | 42 |
43 | K | K | 43 |
44 | L | L | 44 |
45 | M | M | 45 |
46 | N | N | 46 |
47 | O | O | 47 |
48 | P | P | 48 |
49 | Q | Q | 49 |
50 | R | R | 50 |
51 | S | S | 51 |
52 | T | T | 52 |
53 | U | U | 53 |
54 | V | V | 54 |
55 | W | W | 55 |
56 | X | X | 56 |
57 | Y | Y | 57 |
58 | Z | Z | 58 |
59 | [ | [ | 59 |
60 | \ | \ | 60 |
61 | ] | ] | 61 |
62 | ^ | ^ | 62 |
63 | _ | _ | 63 |
64 | NUL | ` | 64 |
65 | SOH | a | 65 |
66 | STX | b | 66 |
67 | ETX | c | 67 |
68 | EOT | d | 68 |
69 | ENQ | e | 69 |
70 | ACK | f | 70 |
71 | BEL | g | 71 |
72 | BS | h | 72 |
73 | HT | i | 73 |
74 | LF | j | 74 |
75 | VT | k | 75 |
76 | FF | l | 76 |
77 | CR | m | 77 |
78 | SO | n | 78 |
79 | SI | o | 79 |
80 | DLE | p | 80 |
81 | DC1 | q | 81 |
82 | DC2 | r | 82 |
83 | DC3 | s | 83 |
84 | DC4 | t | 84 |
85 | NAK | u | 85 |
86 | SYN | v | 86 |
87 | ETB | w | 87 |
88 | CAN | x | 88 |
89 | EM | y | 89 |
90 | SUB | z | 90 |
91 | ESC | { | 91 |
92 | FS | | | 92 |
93 | GS | } | 93 |
94 | RS | ~ | 94 |
95 | US | DEL | 95 |
96 | FNC3 | FNC3 | 96 |
97 | FNC2 | FNC2 | 97 |
98 | SHIFT | SHIFT | 98 |
99 | CODEC | CODEC | 99 |
100 | CODEB | FNC4 | CODEB |
101 | FNC4 | CODEA | CODEA |
102 | FNC1 | FNC1 | FNC1 |
103 | STARTA | STARTA | STARTA |
104 | STARTB | STARTB | STARTB |
105 | STARTC | STARTC | STARTC |
- | STOP | STOP | STOP |
The code value is expected as a comma-separated list of character names. It must start with a character set selection character STARTA, STARTB, or STARTC and must end with a checksum character followed by the STOP character. If these characters are omitted then the system calculates the checksum automatically and adds the required STOP character.
The control characters CODEA, CODEB and CODEC can be used to switch from one character set to another.
The control character SHIFT changes the character set for the immediately following character from A to B and vice versa.
The smartParse property
The smartParse property can be used when the code value consists solely of printable characters. This alleviates users of the need to manually select character sets. When enabled, the resulting bar code is encoded with a shortest possible encoding, for the given string, producing a minimally sized visual representation.
EAN 128 (GS1 128) bar codes
What follows is a sequence of data packets. Each packet starts with a one digit application identifier (AI) from the C character set. The AI is followed by data. The type and amount of expected data is AI specific. The amount can be fixed or variable. In the case of variable amount of data, the end of the data must be indicated by a FNC1 character. Here is a table with some common AIs.
AI | No of Data Characters | Description |
---|---|---|
00 | 18 | Identification of a delivery unit |
01 | 14 | An EAN 13 Number including check digit |
10 | up to 20 alphanumeric characters | Shipping batch identifier |
11 | 3 | Production date in the format YYMMDD |
The complete list of AIs is country specific and is maintained by the local EAN organization. The textual representation requires AIs to be enclosed in round braces. Examples:
Textual representation | code value | Remark |
---|---|---|
(25)03x57 | STARTC, FNC1, 25, 03, CODEB, x, 5, 7 | Note that although, it is a variable length AI, no FNC1 is added at the end in the case when the AI is the last one. |
(30)19(21)3456789012 | STARTC, FNC1, 30, 19, CODEA, FNC1, CODEC, 21, 12, 34, 56, 78, 90, 12 | Note that switching to code a is not necessary, as FNC1 exists in all three character sets. |
If a code contains the control character FNC2 then the decoder does not transmit this value. Instead it appends the value to an internal storage. Only after the decoder encounters a value not containing the FNC2 control character, the decoder transmits the temporary storage and the value read. The temporary storage is then cleared. The purpose of this mechanism is to allow the breaking of long text sequences into several lines.
The effects of the control characters FNC3 and FNC4 are decoder specific.
Decoders remove the character STARTA, STARTB, STARTC, CODEA, CODEB, CODEC, SHIFT, FNC1, FNC2, FNC3, FNC4, STOP, and the checksum character from the data before displaying or transmitting the value.
The last but one character is the checksum character that is calculated as follows:CS=(Ref(1)+Sum(i=2 to n of (i-1)*Ref(i))) mod 103 where Ref(i) is the reference number of the character i, and n is the total number of characters. Example: codeValue="STARTB,A,B,C"CS=(104+(1*33)+(2*34)+(3*35)) mod 103,CS=310 mod 103,CS=1 Looking up reference number 1 in character set B yields the exclamation mark '!' character. The full code value including checksum and stop character is therefore: codeValue="STARTB,A,B,C,!,STOP"
Height and width
The nominal height is 6.5mm. The width of the bar can be calculated using this formula: L/mm=(5.5Nc+11Nab+35)*0.19 where Nc is the number of characters from character set C and Nab denotes the number of characters from character sets A and B. On each side of the bar area 1.9mm padding is added.