Convert string to byte array back and forth with Encoding.UTF8
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace PS_WSSDeploy_Package.Utils { public static class StringUtils { public static byte[] StrToByteArray(string str) { return Encoding.UTF8.GetBytes(str); } public static string ByteArrayToStr(byte[] array) { return Encoding.UTF8.GetString(array); } } }