How to write Unicode and International Languages Barcodes in C#

When writing international languages barcodes, there are a few factors that developers must consider, such as the length of the string and the barcode writing encoding that is appropriate for the string value, as well as the general purpose of the output barcode. IronBarcode fully supports generating and writing barcodes in Unicode, allowing developers to cross borders and have their products placed internationally with barcodes with ease. The following how-to guide provides code examples and considerations that developers must consider when generating them.

Get started with IronBarcode

Start using IronBarcode in your project today with a free trial.

First Step:
green arrow pointer



Writing Unicode Barcode Example

Thanks to IronBarcode's robust support for writing and generating barcodes in Unicode, developers can confidently add and create strings that contain multiple languages to use as a value. For instance, a string that includes a mix of Chinese, Arabic, and Thai can be easily handled, showcasing the tool's versatility and empowering developers to work with diverse language sets.

Below is the following string that we'll use as a barcode value.

string unicodeText = "周態告応立待太記行神正用真最。音日独素円政進任見引際初携食。更火識将回興継時億断保媛全職。文造画念響竹都務済約記求生街東。天体無適立年保輪動元念足総地作靖権瀬内。失文意芸野画美暮実刊切心。感変動技実視高療試意写表重車棟性作家薄井。陸瓶右覧撃稿法真勤振局夘決。任堀記文市物第前兜純響限。囲石整成先尾未展退幹販山令手北結。أم يذكر النفط قبضتهم على, الصين وفنلندا ما حدى. تم لكل أملا المنتصر, ٣٠ حدى مارد القوى. شرسة للسيطرة قامفي. حتى أم يطول المحيط, زهاء وحلفاؤها من فعل. لم قامت الجو الساحلية وتم, ويعزى واقتصار قبل كل。ภคนทลาพาธสตารเซฟต แชมป มารเกตตงลมเหลวโยเกรต แลนดบาบนอมครม รสโซ แบรนดไคลแมกซ พซซาโมเดลเสอโครง มอบโซนรายชอ แอดมชชน ดอกเตอร พะเรอ มารคเจไดโมจราสเบอรร เอนทรานซออดชนศลปวฒนธรรมเปราะบาง โมจซเรยสวอลนตทรป";
string unicodeText = "周態告応立待太記行神正用真最。音日独素円政進任見引際初携食。更火識将回興継時億断保媛全職。文造画念響竹都務済約記求生街東。天体無適立年保輪動元念足総地作靖権瀬内。失文意芸野画美暮実刊切心。感変動技実視高療試意写表重車棟性作家薄井。陸瓶右覧撃稿法真勤振局夘決。任堀記文市物第前兜純響限。囲石整成先尾未展退幹販山令手北結。أم يذكر النفط قبضتهم على, الصين وفنلندا ما حدى. تم لكل أملا المنتصر, ٣٠ حدى مارد القوى. شرسة للسيطرة قامفي. حتى أم يطول المحيط, زهاء وحلفاؤها من فعل. لم قامت الجو الساحلية وتم, ويعزى واقتصار قبل كل。ภคนทลาพาธสตารเซฟต แชมป มารเกตตงลมเหลวโยเกรต แลนดบาบนอมครม รสโซ แบรนดไคลแมกซ พซซาโมเดลเสอโครง มอบโซนรายชอ แอดมชชน ดอกเตอร พะเรอ มารคเจไดโมจราสเบอรร เอนทรานซออดชนศลปวฒนธรรมเปราะบาง โมจซเรยสวอลนตทรป";
Dim unicodeText As String = "周態告応立待太記行神正用真最。音日独素円政進任見引際初携食。更火識将回興継時億断保媛全職。文造画念響竹都務済約記求生街東。天体無適立年保輪動元念足総地作靖権瀬内。失文意芸野画美暮実刊切心。感変動技実視高療試意写表重車棟性作家薄井。陸瓶右覧撃稿法真勤振局夘決。任堀記文市物第前兜純響限。囲石整成先尾未展退幹販山令手北結。أم يذكر النفط قبضتهم على, الصين وفنلندا ما حدى. تم لكل أملا المنتصر, ٣٠ حدى مارد القوى. شرسة للسيطرة قامفي. حتى أم يطول المحيط, زهاء وحلفاؤها من فعل. لم قامت الجو الساحلية وتم, ويعزى واقتصار قبل كل。ภคนทลาพาธสตารเซฟต แชมป มารเกตตงลมเหลวโยเกรต แลนดบาบนอมครม รสโซ แบรนดไคลแมกซ พซซาโมเดลเสอโครง มอบโซนรายชอ แอดมชชน ดอกเตอร พะเรอ มารคเจไดโมจราสเบอรร เอนทรานซออดชนศลปวฒนธรรมเปราะบาง โมจซเรยสวอลนตทรป"
$vbLabelText   $csharpLabel

We then call the BarcodeWriter.CreateBarcode method to create the desired barcode. The method takes in two values: the text and the encoding.

:path=/static-assets/barcode/content-code-examples/how-to/writing-in-unicode-write.cs
using IronBarCode;

// Unicode text with Chinese, Arabic and Thai characters
string text = "周態告応立待太記行神正用真最。音日独素円政進任見引際初携食。更火識将回興継時億断保媛全職。文造画念響竹都務済約記求生街東。天体無適立年保輪動元念足総地作靖権瀬内。失文意芸野画美暮実刊切心。感変動技実視高療試意写表重車棟性作家薄井。陸瓶右覧撃稿法真勤振局夘決。任堀記文市物第前兜純響限。囲石整成先尾未展退幹販山令手北結。أم يذكر النفط قبضتهم على, الصين وفنلندا ما حدى. تم لكل أملا المنتصر, ٣٠ حدى مارد القوى. شرسة للسيطرة قامفي. حتى أم يطول المحيط, زهاء وحلفاؤها من فعل. لم قامت الجو الساحلية وتم, ويعزى واقتصار قبل كل。ภคนทลาพาธสตารเซฟต แชมป มารเกตตงลมเหลวโยเกรต แลนดบาบนอมครม รสโซ แบรนดไคลแมกซ พซซาโมเดลเสอโครง มอบโซนรายชอ แอดมชชน ดอกเตอร พะเรอ มารคเจไดโมจราสเบอรร เอนทรานซออดชนศลปวฒนธรรมเปราะบาง โมจซเรยสวอลนตทรป";

// Create a DataMatrix barcode with the specified text
var myBarcode = BarcodeWriter.CreateBarcode(text, BarcodeWriterEncoding.DataMatrix);

// Save the barcode as an image
myBarcode.SaveAsImage("Unicode.jpeg");
Imports IronBarCode

' Unicode text with Chinese, Arabic and Thai characters
Private text As String = "周態告応立待太記行神正用真最。音日独素円政進任見引際初携食。更火識将回興継時億断保媛全職。文造画念響竹都務済約記求生街東。天体無適立年保輪動元念足総地作靖権瀬内。失文意芸野画美暮実刊切心。感変動技実視高療試意写表重車棟性作家薄井。陸瓶右覧撃稿法真勤振局夘決。任堀記文市物第前兜純響限。囲石整成先尾未展退幹販山令手北結。أم يذكر النفط قبضتهم على, الصين وفنلندا ما حدى. تم لكل أملا المنتصر, ٣٠ حدى مارد القوى. شرسة للسيطرة قامفي. حتى أم يطول المحيط, زهاء وحلفاؤها من فعل. لم قامت الجو الساحلية وتم, ويعزى واقتصار قبل كل。ภคนทลาพาธสตารเซฟต แชมป มารเกตตงลมเหลวโยเกรต แลนดบาบนอมครม รสโซ แบรนดไคลแมกซ พซซาโมเดลเสอโครง มอบโซนรายชอ แอดมชชน ดอกเตอร พะเรอ มารคเจไดโมจราสเบอรร เอนทรานซออดชนศลปวฒนธรรมเปราะบาง โมจซเรยสวอลนตทรป"

' Create a DataMatrix barcode with the specified text
Private myBarcode = BarcodeWriter.CreateBarcode(text, BarcodeWriterEncoding.DataMatrix)

' Save the barcode as an image
myBarcode.SaveAsImage("Unicode.jpeg")
$vbLabelText   $csharpLabel

This is the file that the code produced:

Output Unicode Barcode

Unicode Barcode Writing Encoding

Due to how Unicode works, only selected Barcode types natively support them and directly store Unicode text without encoding workarounds. Aside from the DataMatrix encoding we've done above, here's a quick list of encoding types that support Unicode.

Barcode TypeUnicode SupportBest ForMax Capacity
QR Code✅ Full UTF-8 (Kanji mode for CJK)Marketing, multilingual labels, IDs~3,000 chars (alphanumeric)
Data Matrix✅ With ECI (Extended Channel Interpretation)Industrial, small item labels~1,556 bytes
PDF417✅ With ECI (but limited scanner support)Documents (boarding passes, IDs)~1,100 bytes
Aztec Code✅ Native UTF-8Mobile tickets, airline passes~3,000 chars

Note the difference in the number of characters you can fit with each barcode encoding type. For example, using the string above with PDF417 won't work, as it contains more than 500 Unicode characters. In this case, you need to implement a workaround to make it work. As such, it's important to note the length of your string.

The Barcode types listed above are all available from BarcodeWriterEncoding.

For a complete list of all available barcode encoding types from BarcodeWriterEncoding, please refer here.

Reading the Unicode Barcode

Aside from writing in Unicode, IronBarcode also supports reading Unicode barcodes. To read the barcode, we use the Read method from the BarcodeReader class with the provided parameter being the Unicode barcode.

Here's a quick example using the Unicode barcode generated from above:

:path=/static-assets/barcode/content-code-examples/how-to/writing-in-unicode-read.cs
using IronBarCode;
using System.IO;

// Reading the Unicode barcode
BarcodeResults result = BarcodeReader.Read("Unicode.jpeg");

// Output the text value from the barcode to a txt file
File.WriteAllText("text.txt", result[0].Text);
Imports IronBarCode
Imports System.IO

' Reading the Unicode barcode
Private result As BarcodeResults = BarcodeReader.Read("Unicode.jpeg")

' Output the text value from the barcode to a txt file
File.WriteAllText("text.txt", result(0).Text)
$vbLabelText   $csharpLabel

Note that although you can output the text value to a terminal with Console.WriteLine, the terminal doesn't natively support displaying Unicode characters and requires additional setup. In this example, we directed the output to a txt file instead.

Output

alt text

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

Beyond development, Curtis has a strong interest in the Internet of Things (IoT), exploring innovative ways to integrate hardware and software. In his free time, he enjoys gaming and building Discord bots, combining his love for technology with creativity.