barcodelib icon indicating copy to clipboard operation
barcodelib copied to clipboard

Code-128C needs to support FNC1 char

Open barnhill opened this issue 6 years ago • 2 comments

Code-128C needs to support the FNC1 char as its valid as well as numeric values

barnhill avatar Apr 01 '19 13:04 barnhill

It does already in some way. Entering "È1234" in the BarcodeStandardExample project gives a correct code with:

[STARTC][FNC1][12][34]

where

[STARTC] = Code word 105 [FNC1] = Code word 102 [12] = Code word 12 [34] = Code word 34

È is the character with the code 200 which you have chosen to be used as FNC1 in barcodelib.

If you mean encoding "Code 128-C" in the BarcodeStandardExample needs to support a user-friendly way to add a FNC1 after the start code that would be very easy (a checkbox) but would ignore other aspects of encoding a GS1-128.

What makes a Code 128 code to be a GS1-128 code is that the first code after the start code is FNC1. The start code can be Start A, Start B, or Start C.

A GS1-128 then has an AI, Application Identifier (two, three or four digits). The AI, according to the GS1-128 standard, dictates if the data contents after the AI is numeric or alphanumeric and if it has a fixed length or variable length. If it has a variable length and is follow by another AI + data, another FNC1, in the middle of the code, is used as a delimiter between GS1-128 fields.

https://www.gs1-128.info/application-identifiers/

Off-topic (or side topic): FNC1 in the middle of a barcode is often sent as a GS control character (ASCII 29) (serial data or raw data in for example an intent in Android). When FNC1 is sent as a keyboard stroke the & character is a de facto standard.

I guess this issue is more about some people having the need to encode GS1-128 barcodes. Adding FNC1 support only to the start of Code-128C codes is just a partial fix IMO.

But embracing the GS1-standard fully would be a can of worms from barcodelib's perspective I think. GS1 is a content standard. Even if there is encoding support for it, there is a lot of other rules and recommendations in the GS1-standard, like if you have an item number (GTIN-14):

(01) 12345678901234 it is recommended to have an AI encoding the number of those items in the pallet/logistic unit (37) 1234

My suggestion:

  • A new encoding called GS1-128 which prepends the code with FNC1 and a way to specify FNC1 after a variable length field, automatic switching between code sets to encode the data as efficient as possible
  • A Code 128 encoding/mode which is raw, where the user have total control over code set and special code words, like [STARTA][CR]123ABC[CODEB]abc[CODEC][01][23][FNC1][CODEA][FNC3]

rob313663 avatar Oct 28 '19 18:10 rob313663

Sounds logical and a way to get what Ive had a LOT of requests for ... GS1-128 support

barnhill avatar Nov 03 '19 20:11 barnhill