简体   繁体   English

在 Code 128 条码中编码扩展 ASCII 字符

[英]Encode extended ASCII characters in a Code 128 barcode

I want to encode the string "QuiÑones" in a Code 128 bar code.我想在 Code 128 条码中对字符串“QuiÑones”进行编码。 Is it possible to include extended ASCII characters in the Code 128 encoding?是否可以在 Code 128 编码中包含扩展的 ASCII 字符? . .

I did some research on Google which suggested that it is possible by using FNC4, but I didn't find exactly how to do it.我在谷歌上做了一些研究,表明使用 FNC4 是可能的,但我没有找到确切的方法。 It would be of great help if some one could assist me with a solution in the C language.如果有人可以帮助我用 C 语言解决问题,那将是非常有帮助的。

"Extended ASCII" characters with byte values from 128 to 255 can indeed be represented in Code 128 encodation by using the special FNC4 function character.具有从 128 到 255 字节值的“扩展 ASCII”字符确实可以通过使用特殊的 FNC4 功能字符在 Code 128 编码中表示。 For general use (in open applications) it is necessary that such characters belong to the ISO-8859-1 (Latin1) character set.对于一般用途(在开放应用程序中),此类字符必须属于 ISO-8859-1 (Latin1) 字符集。

A single FNC4 character acts as a shift to the extended character set for the next character whereas two consecutive FNC4 characters act as a latch.单个 FNC4 字符充当下一个字符到扩展字符集的转换,而两个连续的 FNC4 字符充当锁存器。 The effect is to toggle the high bit (basically to add or subtract 128) of the 8-bit ASCII value of the affected characters.效果是切换受影响字符的 8 位 ASCII 值的高位(基本上是加或减 128)。

In your example "QuiÑones" the character "Ñ" is represented by byte value 209 in the default ISO-8859-1 character set, so that's 128+81.在您的示例“QuiÑones”中,字符“Ñ”由默认 ISO-8859-1 字符集中的字节值 209 表示,因此为 128+81。 ASCII 81 resolves to "Q", so you require the sequence FNC4 Q to represent "Ñ". ASCII 81 解析为“Q”,因此您需要序列FNC4 Q来表示“Ñ”。

An efficient Code 128 encodation of this data is as follows:此数据的有效 Code 128 编码如下:

[104/START-B] [49/Q] [85/u] [73/i] [100/FNC4] [49/Q] [79/o] [78/n] [69/e] [83/s] [93/check-digit] [106/STOP]

Some barcode applications and libraries will perform the FNC4-based extended character encoding for you, as in the example below.一些条码应用程序和库将为您执行基于 FNC4 的扩展字符编码,如下例所示。 The majority don't but these should allow you to specify an FNC4 character directly so that you can manually drive the process using the above technique, eg: Qui{FNC4}Qones大多数不会,但这些应该允许您直接指定 FNC4 字符,以便您可以使用上述技术手动驱动进程,例如: Qui{FNC4}Qones

The Code 128 symbol looks like this: Code 128 符号如下所示:

包含单词“QuiÑones”的代码 128

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM