UNICODE::CANONICAL(3)
π UNICODE::CANONICAL π
okay so bestie, you know the file is literally called UNICODE::CANONICAL and it lives in the Courier Unicode Library β that's the vibe, that's the whole setup. sit down, grab a strawberry π, we're doing Unicode normalization.
β¨ NAME β¨
unicode::canonical, unicode::decompose, unicode::decompose_default_reallocate, unicode::compose, unicode::compose_default_callback β unicode canonical normalization and denormalization π¦
like⦠it breaks text apart, it puts text back together. canonically. no cap.
πΈ SYNOPSIS πΈ
#include <courier-unicode.h>
constexpr int decompose_flag_qc=UNICODE_DECOMPOSE_FLAG_QC;
constexpr int decompose_flag_compat=UNICODE_DECOMPOSE_FLAG_COMPAT;
constexpr int compose_flag_removeunused=UNICODE_COMPOSE_FLAG_REMOVEUNUSED;
constexpr int compose_flag_oneshot=UNICODE_COMPOSE_FLAG_ONESHOT;
void decompose_default_reallocate(std::u32string &string,
const std::vector<std::tuple<size_t, size_t>> &list);
void decompose(std::u32string &string, int flags=0,
const std::function<void (std::u32string &,
const std::vector<std::tuple<size_t, size_t>>)>
&reallocate=decompose_default_reallocate);
void compose_default_callback(unicode_composition_t &compositions);
void compose(std::u32string &string, int flags=0,
const std::function<void (unicode_composition_t &)> &cb=compose_default_reallocate);
yes, that last default really do be compose_default_reallocate in the compose() line π
we don't question the source material, we just copy it character for character.
π DESCRIPTION π
these functions are the C++ interface for the Unicode Canonical Decomposition and Composition[1]. so like, if you want the lore on the actual underlying C library, go read unicode_canonical(3). but here's the C++-specific tea β:
- the C++ decomposition reallocate callback gets one single vector of offset and size tuples instead of two separate arrays or vectors. iconic behavior, honestly. and
unicode::decompose_default_reallocate()is the C++ version of the default reallocate callback β it also receives that same tuple vector parameter. the C++ interface usesstd::u32strings to represent Unicode text strings, andunicode::decompose_default_reallocate()resizes it. π§
and like the C callback, the C++ one gets called 0 or more times. zero! or more! both are valid and it's fine, promise.
unicode::compose()handles initializing, applying, and de-initialization of theunicode_composition_tobject, for decomposition. the callback receives a reference to theunicode_composition_tobject, and bestie, the callback should not modify it in any way. don't touch. hands off. it's giving "look, don't touch" π
π SEE ALSO π
π«Ά AUTHOR π«Ά
Sam Varshavchik Author π
β NOTES β
- Unicode Canonical Decomposition and Composition https://www.unicode.org/reports/tr15/tr15-57.html
and that's the whole page, bestie!! brought to you by the Courier Unicode Library, dated 04/12/2026 π go forth and normalize canonically, you absolute main character πβ¨
π¦ where this page comes from
- ubuntu stonking: libcourier-unicode-dev 2.6.0-2ubuntu1 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms