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!