Our Customers
Contact Us Email: support@barcodelib.com
Home > C# Barcode Reader > How to read barcode in C#? > C# read barcodes with Unicode text encoded, Free to Download Trial Package
Download Barcode Reader for .NET Trial

How to scan, read barcodes with Unicode encode using C# in ASP.NET, MVC, Windows apps?

Barcode Reader for C#.NET is the best .NET / C# barcode image recognition component in the market.




About barcode with Unicode text encoding

All of 2D (matrix) barcode symbologies do not support encoding Unicode text directly into barcodes. However most of 2d barcode specifications do support byte array data encoding. Right now a lot of barcode generator software (desktop, web, or mobile) provide Unicode characters encode by using UTF8 encoding. They will convert Unicode text into byte array using UTF8 encode, and generate 2d barcodes with byte array mode.

BarcodeLib Barcode Reader for C# library allows you to use one line of code to read, decode Unicode text from 2d barcodes, such as QR Code, Data Matrix and PDF417.




How to read QR Code barcode with Unicode text encoded using C#?

The QR Code image below contains the Japanese and English characters below using BarcodeLib C# Barcode Generator library.



The following C# example will show how to read and decode the above QR Code using C# barcode reader library.

  • Call method BarcodeReader.BarcodeReader.ReadBarcode() to get the scanned QR Code barcodes information from an existing image file
  • For each recognized QR Code, call GetMessage() to get the QR Code data string using default UTF8 encode
  • Or you can also use the method GetMessage(Encoding.Unicode) to get the QR Code string by specified encode mode
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
            string inputFilePath = "C://Projects//Demo-Files//qrcode-with-unicode.png";

            BarCode[] datas = BarcodeReader.BarcodeReader.ReadBarcode(inputFilePath, BarcodeReader.BarcodeReader.QRCODE);

            Trace.WriteLine("Total QR Codes found: " + datas.Length);

            foreach (BarCode barcodeData in datas)
            {
                string dataInUTF8 = barcodeData.GetMessage();

                string dataInUTF16 = barcodeData.GetMessage(Encoding.Unicode);

                Trace.WriteLine("QR Code data in UTF8: " + dataInUTF8);
                //Trace.WriteLine("QR Code data in UTF16: " + dataInUTF16);
            }
After run the program, you can find the scanned QR Code data string in Unicode in VS output window.






















Also provides .NET Barcode Reader, ASP.NET Barcode Reader, C# Barcode Reader, VB.NET Barcode Reader, .NET QR Code Reader, ASP.NET QR Code Reader, C# QR Code Reader, VB.NET QR Code Reader, .NET Data Matrix Reader, .NET Code 128 Reader, Java Barcode SDK, .NET Barcode SDK, ASP.NET Barcode SDK, Visual C# Barcoding, Visual Basic .NET Barcoding.