IRONSOFTWAREHOME
Set ECI Encoding Policy
using IronBarCode;

// Set the ECI policy once for every 2D barcode
BarcodeWriter.DefaultEciMode = EciMode.ForceUtf8;

// Follows the policy with no further arguments
GeneratedBarcode qr = BarcodeWriter.CreateBarcode("BK005|8389|0001", BarcodeEncoding.QRCode);
qr.SaveAsPng("policy-qr.png");

// Aztec follows the same policy
GeneratedBarcode aztec = BarcodeWriter.CreateBarcode("BK005|8389|0001", BarcodeEncoding.Aztec);
aztec.SaveAsPng("policy-aztec.png");
NuGet Download
PM > Install-Package BarCode
Set ECI Encoding Policy

Set ECI Encoding Policy

A UTF-8 ECI header tells a scanner how to interpret the bytes in a 2D barcode. IronBarcode adds one only when the data contains non-ASCII characters, which keeps ASCII payloads compact. Where a standard requires every symbol to declare its encoding, or a scanner fleet cannot handle ECI at all, one setting changes that decision for every 2D barcode the application produces.

3-Step Guide to Setting an ECI Encoding Policy

  • using IronBarCode;
  • BarcodeWriter.DefaultEciMode = EciMode.ForceUtf8;
  • GeneratedBarcode qr = BarcodeWriter.CreateBarcode("BK005|8389|0001", BarcodeEncoding.QRCode);

Code Explanation

We first import the IronBarcode library, then assign BarcodeWriter.DefaultEciMode. This is a static field, so a single assignment sets the policy for the whole application. EciMode.ForceUtf8 writes the header on every symbol, EciMode.Off never writes it, and EciMode.Auto is the default that writes it only for non-ASCII data.

Afterward, we generate barcodes exactly as we would without the setting. Neither CreateBarcode call passes an encoding argument, yet both the QR code and the Aztec code carry the header, because the static field is read each time a barcode is rendered. This makes it the only way to control ECI on QR, Aztec and PDF417, which have no per-call parameter of their own.

Assign the field once at application startup, before the first barcode is generated, so that every symbol produced afterward follows the same policy.

Explore the full guide to controlling UTF-8 ECI tagging!

Ready to Get Started?

Nuget Downloads 2,452,240Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required