zplCore.comzplCore.com
class11 members

ZplTextEncoding

public sealed class ZplTextEncoding : Encoding

Encoding of ZPL printer bytes as a Zebra printer reads them: every byte is decoded with the single-byte code page of the ^CI that is active at its position (power-up ^CI0 = Code Page 850, ^CI27 = 1252, ^CI31 = 1250, ^CI33 = 1251, ^CI34 = 1253, ^CI35 = 1254, ^CI36 = 1255). Encoding the decoded text gives the same bytes back, so tools that rewrite ZPL (format, redact, gs1 migrate) keep the field data byte-identical.

Bytes after ^CI28–30 keep the code page that was active before (a stream with UTF-8 data is decoded as UTF-8 as a whole by ZplTextEncoding.Decode). A ^CC that changes the caret is not followed.

Constructors

SignatureDescription
# ZplTextEncoding(int defaultCodePage = 850)defaultCodePage: Code page before the first ^CI (850 like a Zebra printer at power-up).

Properties

PropertyTypeDescription
EncodingName { get; }string
IsSingleByte { get; }bool
WebName { get; }string

Methods

Method SignatureReturnsDescription
static # Decode(byte[] data, out Encoding encoding, int defaultCodePage = 850)stringDecodes ZPL bytes: a byte order mark (UTF-8, UTF-16) or valid UTF-8 with non-ASCII bytes selects Unicode, anything else is read like a printer with ZplTextEncoding. encoding encodes the text back.
# GetByteCount(char[] chars, int index, int count)int
# GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)int
# GetCharCount(byte[] bytes, int index, int count)int
# GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)int
# GetMaxByteCount(int charCount)int
# GetMaxCharCount(int byteCount)int