XFA Code128 Character Encoding
Version 2.1165.0 encodes the complete byte range through Code128 FNC4, so non-ASCII field values produce real barcode symbols in native and component workflows
charEncoding selects the bytes carried by the symbol; the XFA field value, runtime edit text and optional human-readable legend remain the original Unicode text
Character encodings
| charEncoding | Actual payload |
|---|---|
| Omitted, UTF-8 or UTF8 | UTF-8 bytes without an automatically added BOM |
| US-ASCII or ASCII | One byte per scalar in 0–127; unrepresentable values fail |
| ISO-8859-1, ISO8859-1 or Latin1 | One byte per scalar in 0–255, using Latin1 rather than a system ANSI code page |
| UTF-16BE | Big-endian UTF-16, without an automatically added BOM |
| UTF-16LE | Little-endian UTF-16, without an automatically added BOM |
| UTF-16 | Big-endian UTF-16 prefixed by FE FF for a nonempty value |
Encoding names are case-insensitive; unknown names and unrepresentable characters fail instead of being replaced by question marks
For example, a value whose Unicode scalars are U+0063 U+0061 U+0066 U+00E9 carries 63 61 66 C3 A9 in UTF-8 and 63 61 66 E9 in Latin1; both legends continue to display the same field text
An empty value continues to generate an empty appearance, including with UTF-16; an actual leading U+FEFF in a nonempty value is data and is preserved independently of the encoding's added BOM
Barcode sets and limits
Automatic code128 selects A or B from each byte's low seven bits and emits FNC4 for its high bit; explicit A accepts 0–95 and 128–223, explicit B accepts 32–127 and 160–255, and explicit C still requires an even number of ASCII digits
FNC4 and set changes participate in the symbol checksum; existing ASCII inputs retain their previous run patterns
Character encoding expansion is checked against the input and working-byte limits before run generation; glyph limits continue to count the original Unicode text, rather than treating UTF-16 expansion as additional glyphs
moduleWidth and dataLength retain the existing sizing contract; longer encoded payloads keep their module widths and extend the visual appearance without moving following fields
Direct byte API
HPDFXFABarcodeBytes(UTF8Value, CharacterEncoding, MaxBytes, CancellationToken) accepts strictly validated UTF-8 source bytes and returns the selected payload encoding; MaxBytes bounds both source and output bytes
The converter rejects malformed, truncated and overlong UTF-8, surrogate code points and values above U+10FFFF; valid U+FFFD remains a real character
Pass the returned bytes to HPDFXFACode128Runs for custom bounded consumers; the raw encoder's MaxCharacters parameter counts bytes, and no implicit system code-page conversion is part of this interface
Scan results should be compared as raw bytes or decoded using the declared character encoding; a scanner's automatically guessed display text does not identify the payload encoding
Code128 field appearances · Runtime values · Focused byte-encoding acceptance (Tests/XFA/BarcodeByteEncoding/Readme.en-us.md)