barnhill / barcodelib

C# Barcode Image Generation Library
Apache License 2.0
744 stars 239 forks source link

Code 93 encoding bug #178

Closed rob313663 closed 7 months ago

rob313663 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

barnhill commented 7 months ago

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

barnhill commented 7 months ago

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

barnhill commented 7 months ago

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