barcodelib icon indicating copy to clipboard operation
barcodelib copied to clipboard

Code 93 encoding bug

Open rob313663 opened this issue 2 years ago • 2 comments

Code 93 supports full ASCII by default. So the string "Test!" should be encodable.

image

I just got Code 93 in my lib to work. This it what it generates:

image

The ①②③④ are the special shift codes in Code 93 (I just chose those Unicode characters to denote them internally).

Breakdown of the encoded code words: * = start T = T ④E = e ④S= s ④T = t ③A = ! AV = check C and K * = stop

image

rob313663 avatar Oct 22 '23 16:10 rob313663

I have investigated, read and learned more about Code 93.

Code 93 (invented by Intermec) was evolved from Code 39. I think the main reason for it to be developed was the fact that it is not possible to determine if a Code 39 code is in full ASCII or not.

So in Code 93, four new code words where introduced as escape codes to tell that it should be combined with the next code word to create a character outside the basic set. These escape code words are not in the basic set of code words.

The implementation in BarcodeLib only supports the basic set of code words. So, in my opinion, BarcodeLib's support of Code 93 is useless since it doesn't do what Code 93 was really designed for.

/rob

rob313663 avatar Oct 26 '23 19:10 rob313663

I have tried and failed with git/github.

Anyway here is a fixed Code 93 for BarcodeLib:

https://www.dropbox.com/scl/fi/ms08p85br7ccnj9h7oy4z/Code93.cs?rlkey=7o8gccl7kjyjl5doeow46mvnm&dl=0

Supports full ASCII (0-127). The following strings have been tested (all tested with Honeywell CT40 and Zebra TC52):

"\u0000\u0001\u0002\u0003" (ASCII 0-3, NUL, SOH, STX, ETX) "aBc" "Test!" "abcdefghijk"

/rob

rob313663 avatar Oct 27 '23 17:10 rob313663

I think you are on to something and Ill get this moved into the lib. Thanks for the help and the contribution!

barnhill avatar Apr 28 '24 20:04 barnhill

Addressed this here: https://github.com/barnhill/barcodelib/pull/202

barnhill avatar Apr 28 '24 20:04 barnhill

closing this pending the review and merge of the above listed PR

barnhill avatar Apr 28 '24 20:04 barnhill