Function formatUnicodeCodepoint [src]

Prototype

pub fn formatUnicodeCodepoint( c: u21, options: FormatOptions, writer: anytype, ) !void

Parameters

c: u21options: FormatOptions

Source

pub fn formatUnicodeCodepoint( c: u21, options: FormatOptions, writer: anytype, ) !void { var buf: [4]u8 = undefined; const len = unicode.utf8Encode(c, &buf) catch |err| switch (err) { error.Utf8CannotEncodeSurrogateHalf, error.CodepointTooLarge => { return formatBuf(&unicode.utf8EncodeComptime(unicode.replacement_character), options, writer); }, }; return formatBuf(buf[0..len], options, writer); }