Barcode Bakery Blog

Detailed Barcode Tutorials

Category: Logistical

Encoding Special Characters

In many cases, our users may need to insert special characters like carriage returns and functions into their barcodes. Each symbology’s ISO standards dictate which characters can be encoded into a barcode and these characters are outlined on our website under each symbology’s respective user manual page. For a step-by-step guide to choosing the correct type of barcode for your project, have a look at our previous post, Choosing the Right Barcode.


How to Insert Special Characters with ASCII Codes


Many special characters can be encoded using Barcode Bakery simply by using PHP’s chr function. The decimal code associated with each special character can be located using an ASCII table and then passed to the function. For example, to insert a carriage return, you’ll want to use chr(13) as follows:

$code->parse(“hello” . chr(13) . “new line”);


This use of the carriage return is useful when a barcode will be scanned to populate a single-input multi-line form such as a text area. If a tab character is required, such as when a barcode will be scanned to populate a form with multiple text inputs, then chr(9) would be used.


How to Insert FNC1 with setTilde()


For certain symbologies such as DataMatrix that allow the FNC1 character, the setTilde() method should be used. By setting its value to true, the tilde character can then be used to insert FNC1 by inserting ~F  into a string. This character is used in most cases to enter a different mode specific to each barcode type.


To find more information about which barcode symbologies can accommodate the special characters you require, check out our user guides in the resources found on our website:

Does barcode size matter?

Barcodes serve many purposes: from a QRCode advertisement on the side of a bus to an Intelligent Mail tracking barcode on an envelope. The size of the barcode will impact their utility greatly. Too small a barcode for an advertisement will go unnoticed and prove ineffective. Too large of a tracking barcode will leave little room for other important information like who the letter came from and who it is being sent to.

Function aside, these barcodes may involve very different methods for being scanned. One may target a consumer passing by with a smartphone, and the other may be interpreted using a handheld scanner. The size of the barcode will affect the readability between these two methods. Image-based readers that are installed on most smartphones will generally have no trouble as long as the barcode can be framed easily in the camera’s frame, but not microscopic.

For handheld LED style readers, there are generally specifications that should be followed to ensure readability. You can find these within the scanner’s manual which usually indicate a depth of field by a minimum barcode element width. This minimum element width corresponds to an individual bar within the barcode. These elements should be larger the further away your scanner is from the barcode. The depth of field refers to how far the scanner is from the barcode being scanned. Scanners have a limit this distance and if it is exceeded, they will not detect the barcode because it is not in its range. By adhering to the respective standards of your reader, you will be able to scan your barcodes with ease.

Another important consideration to bear in mind is that print quality can affect readability. You will need to verify that your printer is capable of printing at a small scale, should your project require it. This should be mentioned in the DPI (dots per inch) specifications that your printer manual provides. Inability to print smaller barcodes will appear as merged elements or unclear element boundaries. Definition in barcode elements is necessary for your reader to distinguish and interpret the data correctly.

The purpose of the barcode, distance of the scanner, and the print quality are factors that should be in mind when starting a project. There are many other considerations unrelated to size that must also be considered, such as the medium the barcode is printed on and its reflectivity. The process of finding the right barcode style to suit your needs is very much a trial-and-error process, but will prove to be much more profitable when the product is most suitable for its respective audience.

Barcode-related Scams

Some organizations, such as GS1, legitimately monitor barcode contents so that they are monitored, organized, and standardized for companies throughout the world. In order for a company or individual to comply with regulations, UPC and EAN codes are mandatorily purchased from GS1– a not-for-profit global standards organization. Many illegitimate organizations profit from consumers by offering these kinds of services. Some of these services include the monitoring of encoded barcode contents and the sale of rights to such contents.

Organizations that claim to monitor the usage of barcode contents so as to limit conflict between two users who might encode the same data generally have no merit or means to facilitate this type of service. When content monitoring is not standardized, provided by a singular central organization, and is not global, it has no value. The sale of rights to encoded content is often no more than the peddling of snake oil. Companies take advantage of consumers who are looking to label unique products. These consumers place their trust in the conduct of these organizations which make a profit appear from out of thin air.

It is important to research the company or organization that you are buying rights from. Verifying their credentials and making sure that they are a reputable and standardized source will ensure that your business remains profitable and resists falling victim to a scam.

What encoding do I use in a barcode?

When choosing how to implement barcodes that interact with sensitive information, you will want to consider your options and what is to be included within your barcodes.

The first method is to simply provide information directly within the barcode (such as client name, account number, etc.). If you are planning to have these barcodes scanned in an area that is offline from your database, this will most likely be the best method for you to use. However, there are some risks associated because anyone can scan the barcode and view the information within it. This may allow them to reproduce a counterfeit version or use the information in a fraudulent way.

The second method is recommended for most users. It involves using an ID within the barcode that, when scanned, will link to a database and retrieve the appropriate information associated with that ID. This ID can be any length or style of your choosing. When using numbers as an ID, however, you will want to consider using a “zerofill” method. This means using “0” as a placeholder to keep your ID length the same as you accumulate higher numbers within your barcodes. If you are concerned with keeping your barcodes the same size, this will generally alleviate the issue.

For most situations, we recommend using a 2D barcode system, such as QR Code, because it allows you to use a wide range of characters. This makes it particularly useful for the first method of implementation I discussed. It will also work the best for the second method as well because it also contains error correction. This is extremely useful when you are providing barcodes to be printed by your clients because you cannot always be sure of the quality of their printer and ink levels. It is also useful if the paper becomes warped or wrinkled (which can often be the case with things like print-at-home movie tickets and labels on shipped or stored items).


© 2018 Barcode Bakery Blog

Theme by Anders NorenUp ↑