Our Customers
Contact Us Email: support@barcodelib.com
Home > .NET Barcode > C# Barcoding Guide > How to Encode Unicode into Barcode with Visual C#.NET
Download Barcode for .NET Suite Trial

C#.NET Barcode Unicode Encoding Guide

Detail Developer Guide for Encoding Unicode Characters into Barcode Using C# Code
  • Professional .NET Barcode Generator SDK for C# barcoding project developers
  • Generate & draw barcode images for ASP.NET Web & .NET Windows Forms applications
  • Generate & print barcode images in C#.NET Class Library & Console applications
  • Use free C# sample code to encode & save linear and matrix barcodes in multiple image file formats: Png, Gif, Jpeg, Bmp, Tiff
  • Easy to encode Unicode into 2d barcodes using Visual C# code, like QR Code, Data Matrix and PDF-417
  • Created 2d barcodes with Unicode encoded comply with latest ISO/IEC & GS1 barcode standards
To be accurate, Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems. It defines almost all the character sets of the human readable characters.
As we know, Unicode is in two bytes, but most 2d barcode types, like QR Code, Data Matrix and PDF-417 can only encode single-byte strings. So, there's should be some conversion technique during encoding Unicode into these 2d barcode images.
Here's a solution. Our C# Barcode Generator Library for .NET can help developers to achieve this.
How to Use C# Class to Encode Unicode in Barcode

Requirement for Encoding Unicode in C# Class

In the following example, we'll take three 2D barcodes as examples: QR Code, Data Matrix, and PDF-417.

Concert Unicode into Base64[] & Generate Barcode

In our C#.NET Barcode Generator Library, we'll use Base64 encoding algorithm to convert Unicode two bytes characters into Base64 firstly. And then encode Base64 string into 2D barcode images in C# class library. Please see free C# sample code below.






Scan Barcode and Get Original Unicode Characters

Certainly, Base64 conversion will be needed if you want to decode the created barcode and obtain your original data. After you get that Base64 string, please use the following C# sample code to convert it back to your Unicode string. This is suitable for all the above three Unicode encoding samples.
     byte[] base64SingleBytes = Convert.FromBase64String(data);
     string UnicodeFromBarcode = System.Text.Encoding.Unicode.GetString(base64SingleBytes);
Related Barcode Libraries that Support Encoding Unicode
Barcode for Visual C#.NET - Other Supported Barcodes
Linear / 1D Barcodes:
Matrix / 2D Barcodes: