4 Stringprep Functions

Stringprep describes a framework for preparing Unicode text strings in
order to increase the likelihood that string input and string
comparison work in ways that make sense for typical users throughout
the world. The stringprep protocol is useful for protocol identifier
values, company and personal names, internationalized domain names,
and other text strings.

4.1 Header file stringprep.h

To use the functions explained in this chapter, you need to include
the file stringprep.h using:

#include <stringprep.h>

4.2 Defining A Stringprep Profile

Further types and structures are defined for applications that want to
specify their own stringprep profile. As these are fairly obscure,
and by necessity tied to the implementation, we do not document them
here. Look into the stringprep.h header file, and the
profiles.c source code for the details.

4.3 Control Flags

Stringprep flags: Stringprep_profile_flagsSTRINGPREP_NO_NFKC

Disable the NFKC normalization, as well as selecting the non-NFKC case
folding tables. Usually the profile specifies BIDI and NFKC settings,
and applications should not override it unless in special situations.

Stringprep flags: Stringprep_profile_flagsSTRINGPREP_NO_BIDI

Disable the BIDI step. Usually the profile specifies BIDI and NFKC
settings, and applications should not override it unless in special
situations.

Stringprep flags: Stringprep_profile_flagsSTRINGPREP_NO_UNASSIGNED

Make the library return with an error if string contains unassigned
characters according to profile.

Prepare the input UCS-4 string according to the stringprep profile,
and write back the result to the input string.

The input is not required to be zero terminated ( ucs4 [ len ] = 0).
The output will not be zero terminated unless ucs4 [ len ] = 0.
Instead, see stringprep_4zi() if your input is zero terminated or
if you want the output to be.

Since the stringprep operation can expand the string, maxucs4len indicate how large the buffer holding the string is. This function
will not read or write to code points outside that size.

The flags are one of Stringprep_profile_flags values, or 0.

The profile contain the Stringprep_profile instructions to
perform. Your application can define new profiles, possibly
re-using the generic stringprep tables that always will be part of
the library, or use one of the currently supported profiles.

Prepare the input zero terminated UCS-4 string according to the
stringprep profile, and write back the result to the input string.

Since the stringprep operation can expand the string, maxucs4len indicate how large the buffer holding the string is. This function
will not read or write to code points outside that size.

The flags are one of Stringprep_profile_flags values, or 0.

The profile contain the Stringprep_profile instructions to
perform. Your application can define new profiles, possibly
re-using the generic stringprep tables that always will be part of
the library, or use one of the currently supported profiles.

Prepare the input zero terminated UTF-8 string according to the
stringprep profile, and write back the result to the input string.

Note that you must convert strings entered in the systems locale
into UTF-8 before using this function, see
stringprep_locale_to_utf8() .

Since the stringprep operation can expand the string, maxlen indicate how large the buffer holding the string is. This function
will not read or write to characters outside that size.

The flags are one of Stringprep_profile_flags values, or 0.

The profile contain the Stringprep_profile instructions to
perform. Your application can define new profiles, possibly
re-using the generic stringprep tables that always will be part of
the library, or use one of the currently supported profiles.