encodeUtf8
public func encodeUtf8(Char, lang.ptr[lang.i8], at: Int64) -> Int64Encodes c as UTF-8 starting at ptr + index, returning the number of bytes written (1–4).
Companion of decodeUtf8. c.utf8Length() predicts the same byte
count without writing — call it first to ensure the buffer has
room.
Safety
ptr + index through ptr + index + utf8Length() - 1 must lie
within an allocated, writable region. No bounds checking happens
here.
Examples
// Conceptually, given a buffer `buf` of length 4:
// encodeUtf8('a', buf, at: 0); // 1
// encodeUtf8('\u{1F600}', buf, at: 0); // 4Defined in lang/std/text/char.ks