18 if (!utf8 || !*utf8)
return std::string();
19 size_t cap = std::strlen(utf8) + 1;
23 out.resize(std::strlen(out.c_str()));
27int copyUtf8(
const char* cp437,
char* out,
size_t out_size)
35 while (n > 0 && (
static_cast<unsigned char>(u[n]) & 0xC0) == 0x80) --n;
37 std::memcpy(out, u.data(), n);
39 return static_cast<int>(n);
Canonical CP437 <-> Unicode/UTF-8 codec.
CDC Badge OS plugin host API - canonical C ABI contract.
#define HOST_ERR_INVALID_ARG
Internal UTF-8 <-> CP437 helpers for the plugin host API boundary.
std::string toUtf8(const char *s)
Convert CP437 bytes to a UTF-8 string.
std::string toDisplay(const char *utf8)
Decode a UTF-8 (with optional HTML entities) string into CP437 bytes.
int copyUtf8(const char *cp437, char *out, size_t out_size)
Encode a CP437 string into a caller buffer as UTF-8.
void decodeWebText(const char *in, char *out, size_t out_size, DisplayTarget target=DisplayTarget::Cp437)
Normalises a web payload for display: HTML named/numeric entities decode first, then UTF-8 multibyte ...
@ Cp437
GFX builtin glcdfont (default after setFont(nullptr)).