-
public static string ByteArray2String(byte[] contentByte)
-
{
-
string result = string.Empty;
-
if(contentByte != null)
-
result = Encoding.GetEncoding("UTF-8").GetString(contentByte, 0, contentByte.Length);
-
-
return result;
-
}
-
-
-
public static byte[] String2ByteArray(string documentText)//(Editor myEditor)
-
{
-
byte[] contentBytes = null;
-
-
/*!!! myEditor.Html中的IMAGE是路径,BodyHtml中的是转换后byte[],但bodyhtml只包含body内的html,
-
取整个文件的html需要使用DocumentText */
-
if (string.IsNullOrWhiteSpace(documentText))
-
contentBytes = null;
-
else
-
contentBytes = Encoding.GetEncoding("UTF-8").GetBytes(documentText);
-
-
return contentBytes;
- }