function Utf8Encode(const S: String): AnsiString;
Encodes a Unicode string into a UTF-8 encoded ANSI string.