Code128条码规范中是否需要校验和? [英] Is a checksum required in the Code128 barcode specification?
问题描述
简介
步骤1
我尝试使用移动条形码阅读器和在线工具读取条形码(请参见下图),并获得:数据- 30925018 ,可视化算法- Code128C >
步骤2
然后我尝试根据给定的数据生成条形码并得到以下图像:
原始条形码
生成的条形码
步骤3
如您所见,图像是不同的.因此,我决定自己解密.结果如下:
原始解密的条形码
生成的解密条形码
С澄清
-
如Wikipedia所述( https://en.wikipedia.org/wiki/Code_128 ):
校验位是加权的103模校验和.通过将起始代码值"与每个符号值"的乘积乘以其在条形码字符串中的位置的乘积相加得出.
-
我试图通过我的应用程序中的Java库以及在线工具根据给定的数据生成条形码.两者都给了我相同的结果.
问题
- 为什么在线工具生成的条形码没有校验和,但末尾有FNC1?
- 为什么条形码的开头有FNC1?
- Code128规范是否要求校验和?
我的想法
- 我认为 GS1-128 规范可能是FNC1的起因条形码 最后的
- FNC1只能是校验和.只是巧合.
原始图像是GS1-128(以前称为EAN-128),代表以下GS1应用程序标识符格式的数据:
(30)925018
含义是项数:925018 .
- 我认为GS1-128规范可能是条形码开头的FNC1的原因
正确.根据定义,以FNC1字符开头的代码128是GS1-128,因此应包含根据GS1规范编码的数据.
以下答案中提供的背景描述了此编码背后的原理: https://stackoverflow.com/a/31760872/2568535
- 最后的FNC1只能是校验和.
在Code 128规范(和任何派生应用标准)中,校验和是必需的,并且通常不会以任何人类可读的文本形式显示.在您生成的符号中(不是GS1-128,因为没有"FNC1开头"),如果校验和字符恰好与FNC1匹配,那只是一个巧合,尽管-正如Brian Anderson所指出的-并非如此.>
Introduction
Step 1
I tried to read the barcode (see image below) using a mobile barcode reader and online tools and got it: data - 30925018, visualization algorithm - Code128C
Step 2
Then I tried to generate a barcode from given data and got these images:
Original barcode
Generated barcode
Step 3
As you can see, the images are different. So, I decided to decrypt it by myself. Here is the result:
Original decrypted barcode
Generated decrypted barcode
Сlarifications
As Wikipedia says (https://en.wikipedia.org/wiki/Code_128):
The check digit is a weighted modulo-103 checksum. It is calculated by summing the start code 'value' to the products of each symbol's 'value' multiplied by its position in the barcode string.
I tried to generate barcode from the given data by Java libs in my application, and by online tools. Both gave me the same result.
Questions
- Why do online tools generate barcodes without a checksum, but with FNC1 at the end?
- Why there is a FNC1 at the beginning of the barcode?
- Is a checksum required by Code128 specification?
My thoughts
- I think GS1-128 specification can be cause of FNC1 at the beginning of the barcode
- FNC1 at the end can be just a checksum. It is just a coincidence.
The original image is a GS1-128 (formerly EAN-128) representing the following GS1 Application Identifier formatted data:
(30)925018
The meaning is Count of items: 925018.
- I think GS1-128 specification can be cause of FNC1 at the beginning of the barcode
Correct. By definition a Code 128 beginning with an FNC1 character in first position is a GS1-128 and should therefore contain data encoded according to the GS1 specification.
The background provided in the following answer describes the principles behind this encoding: https://stackoverflow.com/a/31760872/2568535
- FNC1 at the end can be just a checksum.
The checksum is mandatory in the Code 128 specification (and any derivative application standards) and is not normally displayed in any human-readable text. In your generated symbol (not a GS1-128 since there is no "FNC1 in first") it would just be a coincidence if the checksum character happened to match FNC1, although - as noted by Brian Anderson - it doesn't.
这篇关于Code128条码规范中是否需要校验和?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!