Method TextUnicode
TextUnicode(params ReadOnlySpan<string>)
Creates a FileFormat that validates files are valid Unicode text in any encoding supported by All, for the specified extensions.
Declaration
public static FileFormat TextUnicode(params ReadOnlySpan<string> extensions)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<string> | extensions | The file extensions (including the leading dot, e.g., ".txt", ".md") this file format applies to. Must contain at least one entry. The first extension is the PrimaryExtension that all other extensions are normalized to. |
Returns
| Type | Description |
|---|---|
| FileFormat |
TextUnicode(UnicodeEncodings, params ReadOnlySpan<string>)
Creates a FileFormat that validates files are valid Unicode text in one of the specified encodings, for the specified extensions.
Declaration
public static FileFormat TextUnicode(UnicodeEncodings allowedEncodings, params ReadOnlySpan<string> extensions)
Parameters
| Type | Name | Description |
|---|---|---|
| UnicodeEncodings | allowedEncodings | The Unicode encodings that are accepted. Must specify at least one encoding. |
| ReadOnlySpan<string> | extensions | The file extensions (including the leading dot) this file format applies to. Must contain at least one entry. The first extension is the PrimaryExtension that all other extensions are normalized to. |
Returns
| Type | Description |
|---|---|
| FileFormat |
Remarks
Files with a UTF-8, UTF-16 LE, UTF-16 BE, UTF-32 LE or UTF-32 BE BOM are validated against the encoding indicated by the BOM (which must be one of the
allowedEncodings). Files without a BOM are validated as UTF-8 if Utf8 is included in allowedEncodings; otherwise validation fails.