Use `encode` for this, not `toUTF8`. This overload of `toUTF8` (and `toUTF16`) is undocumented and is going to be removed. It's duplicate functionality, and we don't need it.