Revert "Use the standard library to convert between UTF-8 and UTF-16 where possible"

This reverts commit 19ce4d0dfa8c13255f56342f8c179c6a601d9b2d.