bardecode.com
barcode reading software
  • Home
  • Download
  • Purchase
  • SDK Licensing
  • Pricing
    • Windows SDK Price List
    • Windows SDK with PDF Extension Price List
    • Linux SDK Price List
    • Linux SDK with PDF Extension Price List
    • PDF Extension For Windows Price List
    • Multi-Platform Toolkit for .NET Price List
    • BardecodeFiler Desktop Only Price List
    • BardecodeFiler Windows Service Price List
    • DOS Command Prompt Barcode Tool Price List
    • Terms and Conditions
    • Refund Policy
  • Products
    • Softek Barcode Reader Toolkit for Windows
    • Softek Barcode Reader Toolkit for Linux
    • BardecodeFiler Desktop App
    • BardecodeFiler Windows Service
    • Windows DOS Command Prompt Tool
    • Multi-platform barcode reader toolkit for .NET
    • Aquaforest’s Autobahn DX
  • Knowledge Base
    • Documentation
    • Specifications
  • News
  • Contact
    • About Us
    • Terms and Conditions
    • Resellers
    • Links
Select Page ...

News

Handling unicode encoded barcodes in Java

admin November 26, 2012 Settings, Software Development Kits No Comments

2-D barcode formats such as PDF-417 can encode a huge character set, which means that the barcode reader toolkit needs to encode characters outside the normal ASCII range. If the Encoding property is set to 2 then the toolkit will use Unicode encoding, whereby characters can be represented by the string &#N; where N is an integer.

For example:

Ñ represents the character Ñ

The following Java function may be used to decode such a string:

String decodeBarcodeString(String barcodeString) throws Exception{
String decodedString = “”;
String tempString = “”;
char []array = barcodeString.toCharArray();
for(int i=0; i<array.length;i++){
if(array[i]==’&’)i++;
if(array[i]==’#’){
int j = i;
int count = 0;
int value = 0;
tempString=””;
while(array[++j]!=’;’){
count++;
tempString+=array[j];
}
i+=(count+1);
value = Integer.parseInt(tempString);
if(value==0){
decodedString+=” “;
}else {

decodedString+=Character.toString((char)value);
}
}else{
decodedString+=array[i];
}
}
return decodedString;
}
The above function was kindly supplied by TigerIT Bangladesh Ltd www.tigeritbd.com

← Understanding how the ReadUPCA property works
Reading barcodes through PHP →
admin

  • Copyright © 2023 Softek Software Ltd. All Rights Reserved