Move some deprecated utf8-handling functions to mathoms

This entailed creating new internal functions for some of them to call
so that the functionality can be retained during the deprecation period.