Table of Contents

Class Iso8211WriterOptions

Namespace
EncDotNet.Iso8211
Assembly
EncDotNet.Iso8211.dll

Options for configuring the ISO 8211 writer and builders.

public sealed class Iso8211WriterOptions
Inheritance
Iso8211WriterOptions
Inherited Members

Remarks

These options are the write-side counterpart to Iso8211ReaderOptions and control how records, fields, and subfields are encoded to ISO 8211 bytes.

Properties

AutoSizeDirectoryEntries

Gets or sets a value indicating whether directory entry field-length and field-position widths are automatically sized to fit the record, overriding the sizes declared on the record leader.

public bool AutoSizeDirectoryEntries { get; set; }

Property Value

bool

Remarks

When false (the default), the writer preserves the entry-map sizes declared on the leader (SizeOfFieldLengthField, SizeOfFieldPositionField, SizeOfFieldTagField), which yields byte-identical output for canonically-encoded sources.

When true, the writer computes the minimum widths required to encode the record's largest field length and position. This is useful when constructing records from scratch.

BlankDataRecordFieldControlLength

Gets or sets a value indicating whether a data record whose leader has a field control length of zero is written with two spaces there instead of 00.

public bool BlankDataRecordFieldControlLength { get; set; }

Property Value

bool

Remarks

Only the DDR uses field controls, so ISO/IEC 8211 leaves leader positions 10–11 of a data record blank, and S-57 requires them to be two spaces (S-57 Part 3, Annex A, table A.3). The reader reads both forms as zero. The DDR (leader identifier 'L') is unaffected.

The default is false, which writes 00.

Default

Gets the default writer options (ASCII, lexical level 1, auto-sized directory entries).

public static Iso8211WriterOptions Default { get; }

Property Value

Iso8211WriterOptions

Encoding

Gets or sets the character encoding used for character-based subfield data.

public Encoding? Encoding { get; set; }

Property Value

Encoding

Remarks

When null (the default), the encoding is derived from LexicalLevel: ASCII for levels 0/1 and Unicode (UCS-2) for level 2.

LexicalLevel

Gets or sets the lexical level, which determines terminator width and character encoding.

public int LexicalLevel { get; set; }

Property Value

int

Remarks

Lexical level 0 and 1 use single-byte terminators (UT 0x1F, FT 0x1E) and ASCII/UTF-8 character data. Lexical level 2 uses two-byte terminators (e.g. 0x1F 0x00) and UCS-2 character data, consistent with Iso8211FieldReader.

The default is 1.

TwoByteTerminatorFieldTags

Gets or sets the tags of data record fields that end with the two-byte field terminator 0x1E 0x00, or null for none.

public IReadOnlySet<string>? TwoByteTerminatorFieldTags { get; set; }

Property Value

IReadOnlySet<string>

Remarks

A field encoded in a two-byte character set has its terminators in that character set: S-57 ends a field at lexical level 2 (UCS-2), such as a national attribute (NATF) field, with 0x1E 0x00 (S-57 Part 3, clause 2.5 and Annex B.2).

Iso8211DocumentReader removes only the final byte of every field as its terminator, so the data of such a field keeps the terminator's first byte, 0x1E. The writer ends a field whose tag is in this set with 0x00 instead of 0x1E, completing the terminator, so these fields read and write back unchanged. Their data must end with 0x1E; writing one that doesn't throws InvalidOperationException. The fields of the DDR (leader identifier 'L'), which describe these fields, keep one-byte terminators.