I'm looking for the correct solution to decode a Code 3 of 9 barcode format. What I found on wikipedia stated the following:
Each character is composed of nine elements: five bars and four spaces. Three of the nine elements in each character are wide (binary value 1), and six elements are narrow (binary value 0). - Wikipedia
My questions are as follows:
- By "elements" does that mean one bar?
- Does the binary output of one Code 39 digit have 9 or 12 binary digits?
My assumptions are as follows:
- There is not a check digit
- We are not dealing with full ASCII Code 39
Let's say we have the following barcode:

Let's focus on the start character *. I can think of three different ways to potentially decode this character to binary:
- Assumption that a black bar is
1and a white bar is01001 0110 1101– 12 bits
- Assumption that a thin line is a
0and a thick line is10100 1010 1– 9 bits
- Assumption that a thin line is a
0and a thick line is110110 0110 1101– 12 bits
Which decoding method is correct? If none of them, then please let me know what the correct method is.