How to convert a string to UTF8?

This snippet makes an array of bytes with your string encoded in UTF-8:

UTF8Encoding utf8 = new UTF8Encoding();
string unicodeString = "Quick brown fox";
byte[] encodedBytes = utf8.GetBytes(unicodeString);

This should be with the minimum code:

byte[] bytes = Encoding.Default.GetBytes(myString);
myString = Encoding.UTF8.GetString(bytes);

Try this function, this should fix it out-of-box. You may need to fix naming conventions though.

private string UnicodeToUTF8(string strFrom)
{
    byte[] bytSrc;
    byte[] bytDestination;
    string strTo = String.Empty;

    bytSrc = Encoding.Unicode.GetBytes(strFrom);
    bytDestination = Encoding.Convert(Encoding.Unicode, Encoding.ASCII, bytSrc);
    strTo = Encoding.ASCII.GetString(bytDestination);

    return strTo;
}