Encode Reserved Characters in a barcode
This support issue of encoding reserved characters in an HTML environment applies to the following web-based barcode generation components:
- AJAX & JavaScript Barcode Generator
- ASP Barcode Server for IIS
- Online Barcode Creator
- Dynamic Barcode Generator Service
- ASP.NET Server Control
- Java Barcode Servlet
Solution(s):
Characters such as %, +, and & are reserved for specific purposes. When they are seen in the actual HTML text being sent, the request for a barcode encoding these characters may become distorted when these characters are used. This is due to the HTML processor translation.
The recommended workaround according to W3C is to replace reserved characters with the percent sign (ironically, this is the reason that the percent sign is a reserved character) and the hexadecimal value associated with the ASCII character. For instance, the hex value for the percent sign is 25; therefore, replace all instances of the percent sign with %25. For the ampersand, the hex value is 26, so replace all instances in the data to encode with %26. Therefore, if the data string is 1%1&2%07, change the string to 1%251%262%2507.
