---
name: "unicode::canonical"
section: "3"
platform: "linux"
package: "libcourier-unicode-dev"
version: "2.3.2-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/unicode::canonical"
---

# unicode::canonical(3)

unicode canonical normalization and denormalization

## NAME

unicode::canonical, unicode::decompose, unicode::decompose\_default\_reallocate, unicode::compose, unicode::compose\_default\_callback - unicode canonical normalization and denormalization

## 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);**

## DESCRIPTION

These functions implement the C++ interface for the **Unicode Canonical Decomposition and Composition**\[1\], See the description of the underlying [**unicode\_canonical**(3)](/unicode_canonical/3.md) C library API for more information. C++ specific notes:

• The C++ decomposition *reallocate* callback receives a single vector of *offset* and *size* tuples instead of two separate arrays or vectors. **unicode::decompose\_default\_reallocate**() is the C++ version of the default *reallocate* callback. It receives the receiving the same tuple vector parameter, too. The C++ interface use std::u32strings to represent Unicode text strings, and **unicode::decompose\_default\_reallocate**() **resize**s it.

Like the C callback, the C++ one gets called 0 or more times.

• **unicode::compose**() takes care of initializing, applying, and de-initialization the unicode\_composition\_t object, for decomposition. The callback receives a reference to the unicode\_composition\_t object, which the callback should not modify in any way.

## SEE ALSO

[**courier-unicode**(7)](/courier-unicode/7.md), [**unicode\_canonical**(3)](/unicode_canonical/3.md).

## AUTHOR

**Sam Varshavchik**

Author

## NOTES

- 1\.

  Unicode Canonical Decomposition and Composition

  https://www.unicode.org/reports/tr15/tr15-54.html
