翻译 UPC 条形码中的开销数字

发布于 2024-09-16 00:58:31 字数 685 浏览 2 评论 0原文

我继承了遗留 VB6 条形码库的源代码,没有任何文档。我的理解是它会将 11 位数字转换为 UPC 条形码(我希望我没猜错,可能是 EAN-8)。

据我所知,校验位(最右边的尾随数字)计算正确,购买开销数字(最左边的前导数字)则不然。

通过将源号码中的第一个数字转换为相应的 ASCII 值来转换该数字。 1 变为 Chr(34),2 变为 Chr(35),依此类推。问题是 6 和 0(零)。我猜 6 应该是 Chr(39) (撇号),但条形码无法扫描。我不确定零应该是什么。我尝试了 Chr(33) (感叹号)和 Chr(45) (破折号),但条形码都扫描不到。所有其他翻译的数字都可以正常扫描。

我希望有人以前做过这件事并且知道这些应该是什么,或者知道网上的参考资料。我尝试过谷歌搜索,但我所能找到的只是条形码的一般格式以及如何计算校验位,但没有找到关于翻译开销数字的信息。

编辑1:就其价值而言,我还看到这个数字被称为类型数字和指示符数字。

编辑2:对我来说这实际上是一个糟糕的问题,因为我不知道我在问什么。结果是:1)我正在使用特定的商业条形码字体,2)我需要的不仅仅是开销数字。我用我能找到的东西回答了我自己的问题,但老实说,我的答案毕竟与我的问题没有什么关系。

I've inherited the source to a legacy VB6 barcode library with no documentation. My understanding is it translates an 11-digit number to UPC barcode (I hope I have that right, it might be EAN-8).

As far as I can tell, the check digit (right-most trailing number) is calculating correctly, buy the overhead digit (left-most leading number) is not.

The digit is translated by converting the first digit in the source number to a corresponding ASCII value. 1 becomes Chr(34), 2 becomes Chr(35) and so on. The problem is 6 and 0 (zero). I guess 6 should be Chr(39) (apostrophe), but the barcode doesn't scan. I'm not sure what zero should be. I've tried both Chr(33) (exclamation) and Chr(45) (dash) and barcodes scan for neither. All other translated digits scan fine.

I'm hoping someone has either done this before and know what these should be, or knows a reference on the web. I've tried Googling, but all I can find is the general format of the barcode and how to calculate the check digit, but nothing on translating the overhead digit.

Edit 1: for what it's worth, I've also seen this digit refered to as a type digit and inidcator digit.

Edit 2: this is actually a bad question on my part because I didn't know what I was asking. Turns out 1) I was working with a specific commercial barcode font, and 2) I needed more than the overhead digit. I answered my own question with what I was able to find, but in all honesty my answer turns out to have very little to do with my question after all.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

她比我温柔 2024-09-23 00:58:31

首先,我从来没有做过这样的事情,但我有很好的谷歌技能。 此页面看起来有一些非常完整的信息。列出 UPC / EAN 防护模式和特殊字符的表格与您的不一致,因此您必须让我知道这是否有任何帮助或浪费时间。
替代文字

First, I've never done anything like this, but I have pretty good google skills. This page looks like it has some pretty complete information. The table listing the UPC / EAN guard patterns and special characters do not agree with yours though so you'll have to let me know if this was any help or a waste of time.
alt text

痴意少年 2024-09-23 00:58:31

事实证明,真正的问题并不是算法(尽管它是不正确的),而是这个库是专门为 使用而编写的Wasp 条形码字体。我真正需要的是如何创建机械输出,然后通过字体将其呈现为有效的条形码。

经过一番挖掘,我找到了此页面。虽然是用 Visual FoxPro 编写的,但我能够将其转换为 VB6 以创建我需要的算法。

Turns out the real problem wasn't so much the algorithm (though it was incorrect) but that this library was written specifically for use with Wasp barcode fonts. What I was really needing was how to create the mechanical output that would then be rendered as a valid barcode by the font.

After much digging, I was able to find this page. Though written in Visual FoxPro, I was able to translate it to VB6 to create the algorithm I needed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文