Tcl_UtfToNormalized(3)
πΈ NAME πΈ
Tcl_UtfToNormalized, Tcl_UtfToNormalizedDString β procedures for Unicode normalization. Bestie, you're reading the Tcl_UtfToNormalized(3) page from Tcl Library Procedures, and it is literally all about getting your strings into normalized form. No cap. π¦
β¨ SYNOPSIS β¨
#include <tcl.h>
int
Tcl_UtfToNormalized(interp, src, numBytes, normForm, profile, dst, dstLen, dstWrotePtr)
int
Tcl_UtfToNormalizedDString(interp, src, numBytes, normForm, profile, dstPtr)
π ARGUMENTS π
Tcl_Interp *interp(in) β Interpreter to use for error reporting, orNULLif no error reporting is desired.const char *src(in) β An array of bytes in Tcl's internal UTF-8 based encoding.Tcl_Size numBytes(in) β Length ofsrcin bytes. If the length is negative, the length includes all bytes until the first nul byte.char *dst(out) β Buffer in which the converted result will be stored. No more thandstLenbytes will be stored indst.Tcl_Size dstLen(in) β The size of the output bufferdstin bytes.Tcl_Size *dstWrotePtr(out) β Filled with the number of bytes in the normalized string. This number does not include the terminating nul character. May beNULL.Tcl_UnicodeNormalizationForm normForm(in) β Must be one of theTcl_UnicodeNormalizationFormmembersTCL_NFC,TCL_NFD,TCL_NFKCorTCL_NFKDspecifying the Unicode normalization type.int profile(in/out) β The encoding profile as described in theTcl_GetEncodingdocumentation. Must be eitherTCL_ENCODING_PROFILE_STRICTorTCL_ENCODING_PROFILE_REPLACE.Tcl_DString *dstPtr(out) β Pointer to an uninitialized or freeTcl_DStringin which the converted result, which is also encoded in Tcl's internal UTF-8 encoding, will be stored. The function initializes the storage and caller must callTcl_DStringFreeon success.
π DESCRIPTION π
Okay so Tcl_UtfToNormalized and Tcl_UtfToNormalizedDString transform the passed string into one of the standard normalization forms defined in the Unicode standard. The normalization form is specified via the normForm argument, which must have one of the values TCL_NFC, TCL_NFD, TCL_NFKC or TCL_NFKD, corresponding to the Unicode normalization forms Normalization Form C (NFC), Normalization Form D (NFD), Normalization Form KC (NFKC) and Normalization Form KD (NFKD) respectively. For details on the above normalization forms, refer to Section 3.11 of the Unicode standard (https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-3/). π
Tcl_UtfToNormalized stores the normalized result in the buffer provided by the caller through the dst argument. The result is nul terminated, but the nul is not included in the count of stored bytes returned in dstWrotePtr. The function returns TCL_OK on success, TCL_CONVERT_NOSPACE if there is insufficient room in the output buffer and TCL_ERROR in case of other failures. In the latter two cases, an error message is stored in interp if it is not NULL. π«Ά
Tcl_UtfToNormalizedDString stores the normalized result in dstPtr, which must eventually be freed by caller through Tcl_DStringFree. The function returns TCL_OK on success and TCL_ERROR on failure with an error message in interp if it is not NULL. β¨
π¦ SEE ALSO π¦
π KEYWORDS π
utf, Unicode, normalize
xoxo π β Tcl 9.1, Tcl_UtfToNormalized(3). The footer didn't hand us a date, bestie, so that's the whole cute sign-off πβ¨
π¦ where this page comes from
- nixpkgs unstable: tcl 9.1.0
- Copyright (c) 2025 Ashok P. Nadkarni
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms