Error 3751: barcode contains invalid characters - Issues with the apostrophe symbol in barcodes Follow

Avatar
Alex Sempf

Symptom

You encounter an issue with apostrophes being "invalid characters" for the particular barcode symbology, even though the barcode supports the apostrophe symbol.

Environment

BarTender
Integration Builder

Fix/Answer

First, make absolutely certain that the barcode symbology does indeed support the apostrophe character. For this example, I will be using the Code 128 symbology.

Next, it is important to know that there are two kinds of apostrophes out there:

This is the "standard" apostrophe when entered from a US English keyboard: '
This is the other apostrophe that might be used by other region's keyboards: ’

By default, a new Code 128 barcode has the Text Encoding setting (within Symbology and Size) set to "US, Western Europe (7-Bit ASCII)", which does not support the "foreign" apostrophe. The apostrophe will appear as a ? symbol in the barcode's human readable portion, and BarTender will produce error message #3751, which says "Barcode object '<object name>' contains invalid characters for the selected encoding":



To resolve this issue, change the barcode's Text Encoding setting to "Unicode (UTF-8)", which does support the "foreign" apostrophe. The apostrophe should now appear within the barcode's human readable portion, and the error message from BarTender should no longer appear.



However, issues with the "foreign" apostrophe might extend past BarTender and cause issues with your scanner or printer. If this is the case, you may need to utilize a "Search and Replace" transform to replace all "foreign" apostrophes with "standard" apostrophes, if this is permitted for your particular use-case.

Was this article helpful?

Please sign in to leave a comment.