-->

TAB key in Code128 barcodes

2019-01-20 14:50发布

问题:

I'm trying to create a barcode with a TAB key within it.
It seems as though some generators (only found one thus far) uses ~ as a TAB key.
But I can't seem to get it to work with any of the other generators.

I've also read that Code128 A supports ASCII, meaning "HT" should work as a Horizontal Tab.

Any ideas on what Code128 decrypts as TAB?

回答1:

Generating a Code 128 containing an ASCII control character

Code 128 can be used to encode any character in the Latin-1 character set, including ASCII control characters (ordinals 0 to 31).

Here is a Code 128 barcode representing a lone HT character (ASCII value 9):

The internal encoding uses code set A and contains these code words:

[103/START-A] [73/HT] [73/check-digit] [106/STOP]

General effect of scanning barcodes containing ASCII control characters

Scanning any type of barcode containing ASCII control characters may not give the intended result due to the diverse ways that the barcode contents may be provided to the system. Each method will provide different ways to configure how control codes are presented to your application.

A hardware reader might be configured in "keyboard wedge" mode where the device emulates a physical keyboard by generating keyboard scan codes. In this case you can usually configure the device to provide specific "key sequences" before and after scanning, as well as provide a mapping from the Latin-1 ordinals (0-255) represented in a barcode to the physical scan codes read by the keyboard interface, For example, in a particular application one might choose to map Carriage Return (ASCII 13) to the Down Arrow (5000) scan code. This text describes the relationship between ASCII control characters and scan codes.

Alternatively a hardware or software reader may use a driver. There is a lot of variation with this approach but often they provide a synthetic RS232 interface (perhaps over USB) or hook into the OLE subsystem of the operating system. In the most basic case scanning a barcode would be equivalent to pasting some text into a textfield – you may require the device/software to perform some kind of translation of the raw barcode data and you may also need to modify the application to react appropriately to the input. Consider for example that the result of pasting some text containing a TAB character into a text field isn't necessarily the same as actually typing that text (which includes pressing the TAB key) on the keyboard.

A barcode reader's documentation should describe the interfaces available and methods for customising the presentation of scanned data.



回答2:

@terry-burton - You gave an excellent response for the answer. Your write up provided me direction to where I needed to look for my answer. To solve my problem, and possibly to answer @nir-tzezana question, I found my answer in the scanner's documentation.

Correct barcode - I first ensured that my code128 was properly formatted and included the ASCII code for 'tab'. In my situation I have a number of tabs set inside a large string so I can quickly scan one barcode code and have multiple cells in excel populated.

Enable Function Key Mapping - Our environment uses Symbol LS2208 scanners. I obtained this manual and printed manual the page 7-14. In particular, I needed to enable 'Enable Function Key Mapping' on the device. If you refer to the table found on page 7-15 you'll see that the 'tab' key can be overused depending on the scanner setting. By making this change my scanner can now successfully parse the following string into correct cells.

Example:

MyCode128Function(Text123&Chr(9)&Text456&Chr(9)&Test789)


回答3:

I am having the same issue.. try to open notepad make your text example:

1 (press tab) 1 (press tab)(press tab)1

then select copy and paste. into your label software . format 128auto

it works fine.



回答4:

Please try use ^K for horizontal tab. Hope it should work