Function

uni_validate

Validate text.

Since v1.0
unistat uni_validate(
const void *text, unisize text_len, uniattr text_attr)

Parameters 🔗

text in

Input text.

text_len in

Number of code units in text or -1 if text is null terminated.

text_attr in

Attributes of text.

Return Value 🔗

UNI_OK

If text is well-formed.

UNI_BAD_OPERATION

If text is NULL.

UNI_BAD_ENCODING

If the encoding of text is malformed.

UNI_FEATURE_DISABLED

If the encoding form flagged in text_attr is disabled.

Discussion 🔗

Check if text is well-formed. The length of text is given in code units by text_len and its encoding form is specified by text_attr.

The UNI_TRUST flag has no effect when used with text_attr as the entire purposes of this function is to verify text is well-formed and assuming it is well-formed would defeat the purpose.