Secure by Default

Charisma provides functions for decoding and encoding characters safely in UTF-8, UTF-16, and UTF-32 (big or little endian) from both null and non-null terminated strings. It can recover from malformed characters, allowing decoding to continue. Its implementation is reentrant, atomic, and thread-safe.

MISRA C:2012 Compliant

Charisma honors all Mandatory, Required, and Advisory rules defined by MIRSA C:2012. The complete compliance table is documented here.

Extensively Tested

  • 100% branch coverage
  • Unit tests
  • Fuzz tests
  • Static analysis
  • Valgrind analysis
  • Code sanitizers (UBSAN, ASAN, and MSAN)
  • Extensive use of assert() and run-time checks

Ultra Portable

Charisma does not require an FPU or 64-bit integers. It is written in C99 and only requires a few features from libc which are listed in following table.

Header Types Macros
stdint.h uint8_t, uint16_t,
int32_t, uint32_t
stdbool.h bool, true, false
assert.h assert

Related Work

Charisma is focused on safely decoding and encoding Unicode characters. If you need Unicode algorithms, like normalization or collation, then see Unicorn.