How to Write UTF-8 & Unicode Barcodes in C#
IronBarcode enables developers to encode UTF-8 text - including Chinese, Arabic, Thai, and other international scripts - into barcodes using formats like DataMatrix and QR Code, which natively support UTF-8 characters for international product labeling.
Generate a barcode containing mixed-language Unicode text using IronBarcode in one line, then save it as an image.
-
1Install IronBarcode with NuGet Package Manager
-
2Copy and run this code snippet.
var barcode = IronBarCode.BarcodeWriter.CreateBarcode("123 英語 اللغة العربية", IronBarCode.BarcodeWriterEncoding.DataMatrix); barcode.SaveAsImage("unicode.png");C# -
3Deploy to test on your live environment
Start using IronBarcode in your project today with a free trial
Minimal Workflow (5 steps)
- Download the IronBarcode C# library to write Unicode barcodes in C#
- Put UTF-8 Characters in a string
- Set the BarcodeWriterEncoding property to DataMatrix encoding
- Generate a barcode with the Unicode string with the
CreateBarcodemethod - Save the barcode as an image with SaveAsImage
How Do I Create a UTF-8 Barcode with Mixed Languages?
IronBarcode supports writing and generating barcodes in Unicode (UTF-8 encoded), allowing developers to create strings that contain multiple languages as barcode values. For instance, a string that includes a mix of Chinese, Arabic, and Thai can be handled directly.
Unicode support in barcode generation is essential for global applications, enabling businesses to create product labels, shipping documents, and identification systems that work across different languages and regions. The IronBarcode library provides seamless handling of UTF-8 encoded text, making it the ideal solution for international barcode requirements.
Below is the following string that we'll use as a barcode value.
string unicodeText = "周態告応立待太記行神正用真最。音日独素円政進任見引際初携食。更火識将回興継時億断保媛全職。文造画念響竹都務済約記求生街東。天体無適立年保輪動元念足総地作靖権瀬内。失文意芸野画美暮実刊切心。感変動技実視高療試意写表重車棟性作家薄井。陸瓶右覧撃稿法真勤振局夘決。任堀記文市物第前兜純響限。囲石整成先尾未展退幹販山令手北結。أم يذكر النفط قبضتهم على, الصين وفنلندا ما حدى. تم لكل أملا المنتصر, ٣٠ حدى مارد القوى. شرسة للسيطرة قامفي. حتى أم يطول المحيط, زهاء وحلفاؤها من فعل. لم قامت الجو الساحلية وتم, ويعزى واقتصار قبل كل۔ภคนทลาพาธสตารเซฟต แชมป มารเกตตงลมเหลวโยเกรต แลนดบาบนอมครม รสโซ แบรนดไคลแมกซ พซซาโมเดลเสอโครง มอบโซนรายชอ แอดมชชน ดอกเตอร พะเรอ มารคเจไดโมจราสเบอรร เอนทรานซออดชนศลปวฒนธรรมเปราะบาง โมจซเรยสวอลนตทรป";netWe then call the BarcodeWriter.CreateBarcode method to create the desired barcode. The method takes in two values: the text and the encoding. Learn more about creating barcodes from various data types including URLs, IDs, and binary data.
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
Dim text As String = "周態告応立待太記行神正用真最。音日独素円政進任見引際初携食。更火識将回興継時億断保媛全職。文造画念響竹都務済約記求生街東。天体無適立年保輪動元念足総地作靖権瀬内。失文意芸野画美暮実刊切心。感変動技実視高療試意写表重車棟性作家薄井。陸瓶右覧撃稿法真勤振局夘決。任堀記文市物第前兜純響限。囲石整成先尾未展退幹販山令手北結。أم يذكر النفط قبضتهم على, الصين وفنلندا ما حدى. تم لكل أملاً المنتصر, ٣٠ حدى مارد القوى. شرسة للسيطرة قامفي. حتى أم يطول المحيط, زهاء وحلفاؤها من فعل. لم قامت الجو الساحلية وتم, ويعزى واقتصار قبل كل。ภคันทลาพาธสตาร์เซฟตี้ แชมป์ มาร์เก็ตติ้งล้มเหลวโยเกิร์ต แลนด์บาบูนอึมครึม รุสโซ แบรนด์ไคลแม็กซ์ พิซซ่าโมเดลเสือโคร่ง ม็อบโซนรายชื่อ แอดมิชชั่น ด็อกเตอร์ พะเรอ มาร์คเจไดโมจิราสเบอร์รี เอนทรานซ์ออดิชั่นศิลปวัฒนธรรมเปราะบาง โมจิซีเรียสวอลนัตทริป"
' Create a DataMatrix barcode with the specified text
Dim myBarcode = BarcodeWriter.CreateBarcode(text, BarcodeWriterEncoding.DataMatrix)
' Save the barcode as an image
myBarcode.SaveAsImage("Unicode.jpeg")This is the file that the code produced:

Output Unicode Barcode
For enhanced styling options, you can also customize your Unicode barcodes with colors, margins, and annotations to meet specific branding requirements.
Which Barcode Types Support Unicode Characters?
Unicode support varies by barcode type. Only selected barcode formats natively support Unicode 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 Type | Unicode Support | Best For | Max 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-8 | Mobile 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 to our supported barcode formats documentation to discover the full capabilities of IronBarcode's Unicode support.
Best Practices for Unicode Barcode Generation
When working with Unicode barcodes, consider these important factors:
- Character Encoding: Always ensure your source text is properly UTF-8 encoded before generating barcodes
- Scanner Compatibility: Verify that your barcode scanners support Unicode decoding for your chosen barcode type
- Data Size: Monitor the byte size of your Unicode text, as characters like Chinese or Arabic typically require 2-3 bytes each
- Error Correction: For critical applications, use higher error correction levels to ensure reliable scanning
For QR Code generation specifically, check out our comprehensive C# QR Code Generator tutorial which includes advanced Unicode handling techniques.
How Do I Read Unicode Barcodes in C#?
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:
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)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

Common Use Cases for Unicode Barcodes
Unicode barcode generation serves numerous practical applications across global industries:
- International Product Labeling: Create product labels that display information in multiple languages for global distribution
- Logistics and Shipping: Generate shipping labels with addresses in native scripts for accurate international delivery
- Healthcare: Encode patient information including names in native languages for medical records and prescriptions
- Event Management: Create tickets and passes with attendee names in their native scripts
- Document Management: Generate document identifiers containing metadata in multiple languages
For more advanced barcode operations, explore our API Reference documentation to discover the full capabilities of IronBarcode's Unicode support.
Frequently Asked Questions
What is the primary benefit of using Unicode barcodes with IronBarcode?
The primary benefit of using Unicode barcodes with IronBarcode is the ability to encode UTF-8 text, including Chinese, Arabic, Thai, and other international scripts, allowing for versatile and worldwide applicability in product labeling, shipping, and various global industry needs.
How do you create a Unicode barcode with mixed languages using IronBarcode?
To create a Unicode barcode with mixed languages using IronBarcode, you must use the 'CreateBarcode' method. This method encodes the string containing multiple languages, such as Chinese, Arabic, and Thai, into a DataMatrix barcode format which supports UTF-8.
Which barcode formats natively support Unicode characters?
The barcode formats that natively support Unicode characters include QR Code, Data Matrix, PDF417, and Aztec Code. These formats are suitable for marketing, multilingual labels, industrial labeling, and mobile ticketing.
Can IronBarcode generate barcodes with a string containing more than 500 Unicode characters?
Yes, IronBarcode can generate barcodes with strings containing more than 500 Unicode characters using encoding types like QR Code and Aztec Code. However, for formats like PDF417, which have smaller capacity limits, alternative methods or encoding workarounds may be necessary.
What steps should be considered when generating Unicode barcodes?
When generating Unicode barcodes, consider the character encoding, ensure compatibility with barcode scanners, monitor the data size of the Unicode text, and apply appropriate error correction levels to maintain reliable scanning.
Can IronBarcode read Unicode barcodes generated with its library?
Yes, IronBarcode can read Unicode barcodes using the 'BarcodeReader.Read' method. This feature allows you to extract and manage the multilingual text encoded within the barcode.
What are some common use cases for Unicode barcode generation?
Common use cases for Unicode barcode generation include international product labeling, logistics and shipping, healthcare patient information encoding, event management for creating tickets, and document management with multilingual metadata.
How does IronBarcode handle barcode image output?
IronBarcode allows you to save generated barcodes as image files using the 'SaveAsImage' method, which provides flexibility in storing and sharing the barcodes.
What should you do if your terminal doesn't support displaying Unicode characters when reading barcodes?
If your terminal does not natively support displaying Unicode characters, it's recommended to output the text value from the barcode to a text file instead, which ensures proper handling of multilingual scripts.
Where can you customize Unicode barcodes with IronBarcode?
IronBarcode provides options for customizations such as adjusting colors, margins, and adding annotations, helping to align barcode designs with specific branding requirements.

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.