Extend string_to_utf8() to support generating UTF-8 encoded UTF-16 surrogates.

Imported from https://youtrack.roxen.com/issue/PIKE-111

Reported by @grubba

A work-around to forcing a change of all fields from utf8 to utf8mb4 is to use surrogate encoding, as this will keep the characters seen by MySQL/MariaDB to the BMP.