The issue we are having is that we are taking a document and trying to save it as HTML.
Then when we feed it thru the UTF8 encoding we are getting the Byte order markers at the beginning of the of the string.
MemoryStream outpuStream = new MemoryStream();
Aspose.Words.Document documentToConvert = new Aspose.Words.Document(fileNameAndPath);
documentToConvert.Save(outputStream, Aspose.Words.SaveFormat.Html);
string htmlDocument = System.Text.Encoding.UTF8.GetString(outputStream.GetBuffer(),
0, Convert.ToInt32(outputStream.Length));
So when we try and send the html document over the web or save it to a database it is getting the BOM along withit. We don’t want that there.
So we are having to manually remove it by changing it to the following adding the bolded text:
MemoryStream outpuStream = new MemoryStream();
Aspose.Words.Document documentToConvert = new Aspose.Words.Document(fileNameAndPath);
documentToConvert.Save(outputStream, Aspose.Words.SaveFormat.Html);
string htmlDocument = System.Text.Encoding.UTF8.GetString(outputStream.GetBuffer(),
0, Convert.ToInt32(outputStream.Length));
string _byteOrderMarkUtf8 = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
if (htmlDocument.StartsWith(_byteOrderMarkUtf8))
{
htmlDocument = htmlDocument.Remove(0, _byteOrderMarkUtf8.Length);
}
Is there any way we can make this an option, so we dont have to removing it manually?
–Clayton Meisman