We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML conversion not preserving special characters

I am trying to convert a TEXT document to HTML using Aspose.words. The text document contains special character. This special character is not getting reproduced in the converted HTML document.

Attaching the TEXT document for reference.

Hi Kalpesh,

Thanks for your inquiry. Please instruct Aspose.Words to load this text file using UTF8 encoding as follows:

Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();

loadOptions.LoadFormat = LoadFormat.Text;

loadOptions.Encoding = ASCIIEncoding.UTF8;

Document doc = new Document(MyDir + @"test.txt", loadOptions);

doc.Save(MyDir + @“out.html”);

I hope, this helps.

Best regards,
1 Like