`utf8_bytes()` was a hack to get a particular job done in a hopefully portable manner. We needed a way to escape XML special characters. XML characters can include non-ASCII UTF-8 characters.
It's awkward, partly because it's paranoid about the value of `CHAR_BIT`: UTF-8 uses 8-bit bytes, while the size of a C byte is implementation-dependent.
It also may have errors. Maintainers of a widely used, general-purpose library are more likely to find and fix those errors, compared to our small group of developers with a piece of code that sees very limited use.
This task is to explore using GLib UTF-8/Unicode functions to fill the role of `utf8_bytes()`. We may find other uses for them as well.