STRING-NORMALIZE-NFKC(3scm)
π string-normalize-nfd(3scm) π
okay bestie, welcome to the Scheme Programmer's Manual page for string-normalize-nfd(3scm). This is your Unicode-normalization group chat, and all four functions are here to slay. β¨
πΈ NAME πΈ
string-normalize-nfd, string-normalize-nfkd, string-normalize-nfc, string-normalize-nfkc β Unicode normalization. periodt.
π LIBRARY π
These imports are the vibe:
(import (rnrs)) ;R6RS
(import (rnrs unicode)) ;R6RS
πͺ SYNOPSIS πͺ
(string-normalize-nfd string)
(string-normalize-nfkd string)
(string-normalize-nfc string)
(string-normalize-nfkc string)
π DESCRIPTION π
Returns string normalized to Unicode normalization form D, KD, C, or KC, respectively:
- D β Canonical Decomposition
- KD β Compatibility Decomposition
- C β Canonical Decomposition followed by Canonical Composition
- KC β Compatibility Decomposition followed by Canonical Composition
no cap, that's the whole mapping. π«Ά
π RETURN VALUES π
Returns a single value; a string.
When the specified result is equal in the sense of string=?(3scm) to the argument, these procedures may return the argument instead of a newly allocated string.
π¦ EXAMPLES π¦
watch the glow-up:
(string-normalize-nfd "\xE9;")
=> "\x65;\x301;"
(string-normalize-nfc "\xE9;")
=> "\xE9;"
(string-normalize-nfd "\x65;\x301;")
=> "\x65;\x301;"
(string-normalize-nfc "\x65;\x301;")
=> "\xE9;"
π APPLICATION USAGE π
In Unicode a string that renders as "ΓΆ" can consist of one character or several characters that combine or join into a single character when rendered. The normalization forms are different standard ways to break up or combine characters in this way. There are various uses for these procedures in applications that deal with Unicode data. They may be used before encoding strings or before comparing them, such as when searching in a dictionary. The Linux console does not render combining marks, so NFC normalization can be useful there.
literally, if your terminal is giving "where did the accent go?" energy, NFC might be your main character. π
π₯ COMPATIBILITY π₯
These procedures are unique to R6RS, but if the same functionality is found through some other library, then they can be expected to behave the same as those in R6RS. See the section on "versioning and stability" in UAX #15 (link below).
π ERRORS π
This procedure can raise exceptions with the following condition types:
&assertion(R6RS) β The wrong number of arguments was passed or an argument was outside its domain.
π SEE ALSO π
string-upcase(3scm)- Unicode Standard Annex #15: Unicode Normalization Forms.
β STANDARDS β
R6RS
π§ HISTORY π§
These procedures first appeared in R6RS.
π AUTHORS π
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.
mwah π β this was the string-normalize-nfd(3scm) page, dated 2022-05-13. bye bestie, go normalize something iconic! πΈ
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2022 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms