Code 39 is a discrete “self-checking” code (i.e. it has inter-character gaps) and is undoubtedly the most commonly used code outside retail labelling.
The standard Code 39 symbology supports upper case letters, numbers and the following additional characters; SPACE, HYPHEN/MINUS (-), POINT(.), PLUS(+), DIVIDE(/), DOLLAR($) and PERCENT(%). No other characters are allowed!
The Extended Code 39 symbology supports the full ASCII character set - although it does this at a price by using two barcode characters to represent each code character (the a is represented in the barcode by +A). Extended Code 39 symbols can thus become rather long, creating difficulties for the scanner.
This code must begin with a start character and must end with a stop character. The start character is § (Chr$(167)) and the stop character is ¬ (Chr$(172)).
For convenience in typing in Code 39 [but NOT in Extended Code 39] the open bracket ( may be used as the start character, and the close bracket ) may be used as the stop character.
Code 39 symbols are self-checking so are normally used without a check digit. However, they may employ an optional check digit as the last character before the stop character.
The check digit is calculated using a modulo 43 algorithm, using the value of each character as follows:
|
character |
value |
|
0 - 9 |
0-9 |
|
A-Z |
10 - 35 |
|
- |
36 |
|
. |
37 |
|
(space) |
38 |
|
$ |
39 |
|
/ |
40 |
|
+ |
41 |
|
% |
42 |
|
* |
43 (i.e. ignored) |
The check digit is calculated by summing the character values to give Sum, and using the formula
checkdigitvalue = Sum Mod 43
The check digit is then the corresponding character in the table above.
The dFont program provided with the dLSoft Barcode fonts calculates check digits and for both Code 39 and Extended Code 39, and the source code is provided and may be adapted to the users needs - for example, for automating the calculation in a spreadsheet or database.
Because the space character does not print from some Windows applications the space character is reproduced at ASCII 159 and 160.
If Extra1 is true the start and stop characters are shown as an asterisk in font which includes the human-readable form.
Note that Code39 is supplied as a different font from Extended Code 39 - even though the upper case letters and numbers are the same in both fonts. This is because some characters are not the same. For example, + in Code 39 is represented as /K in Extended Code 39 - to avoid the sequence +A being misinterpreted.
For convenience of handling Extended Code 39 characters with ASCII values of less than 32 are reproduced in the font at the character positions chr$(192) - chr$(223), and ASCII 127 is reproduced at ASCII 191.
More: