Repository navigation
v0.13.0
0.13.0 (2026-11-02)
Added
muniMeasureUtf8finds the longest prefix of UTF-8 text that ends at
a boundary of amuniTextUnitand holds at mostmaxBytesbytes and
at mostmaxUnitsunits, and gives its length in bytes and in units;
either output may be NULL. It turns a byte offset into a count of
units, turns a count of units into a byte offset, cuts text to fit a
buffer, and counts the grapheme clusters of a whole text or finds
where a count of them ends. A limit that falls inside a code point or
a cluster ends the prefix at the boundary before it, and a count of
UTF-16 units that falls inside a surrogate pair ends it before the
pair. A call that fits whole and asks for no count does not walk the
text
(#243).muni_unitUtf16, a newmuniTextUnit, counts UTF-16 units: one for
a code point up to U+FFFF, two for one past it, and one for a maximal
ill-formed subpart, as its U+FFFD. WithmuniMeasureUtf8it maps
UTF-8 byte offsets to the UTF-16 offsets that AppKit, UIKit and
Android take, and back
(#243).
Changed
- Breaking: on
muni_errorCapacity,muniConvertUtf8ToUtf16,
muniConvertUtf16ToUtf8,muniConvertUtf8ToUtf32and
muniConvertUtf32ToUtf8give the input offset of the first code
point not written, instead of the input length. The output holds the
conversion of the input before that offset, always whole code points,
andneededOutstill counts the whole conversion. A caller can keep
what was written, or convert the rest from the offset, instead of
converting again with less input until it fits. A strict-mode error
after the output filled up still returns that error and its offset.
Code that read the input length from the offset on
muni_errorCapacityuses its ownlength
(#241).
Removed
-
Breaking:
muniCutUtf8is removed.muniMeasureUtf8with
maxUnitsset toSIZE_MAXgives the same cut; the unit now comes
before the byte limit. No consumer called it
(#243).0.12.0 0.13.0 muniCutUtf8(text, length, budget, unit, &cut)muniMeasureUtf8(text, length, unit, budget, SIZE_MAX, &cut, NULL)