Free Support Forum - aspose.com

Document encoding at creation

Hello! Faced the following problem. I am creating a new Html document in which I use Russian text. The problem is that when the created document is opened in the browser, the Russian text is not displayed, instead of it various characters. I understand that there is a problem with the encoding, but I cannot figure out how to solve it. If I add manually to the META charset = utf-8 file everything works correctly. Is there a way to enter this line in the code? I’ve tried creating an object of type HTMLMetaElement, but it doesn’t have a charset property. Here is the code

var document = new Aspose.Html.HTMLDocument();
var meta = document.CreateElement(“META”) as HTMLMetaElement;
var table = document.CreateElement(“TABLE”) as HTMLTableElement;
table.Border = “0”;
table.Width = “86%”;
table.Align = “center”;
var tableRow = document.CreateElement(“TR”) as HTMLTableRowElement;
table.AppendChild(tableRow);
var tableCell = document.CreateElement(“TD”) as HTMLTableCellElement;
table.AppendChild(tableCell);
var h2 = document.CreateElement(“H2”) as HTMLHeadingElement;
h2.TextContent = “Отчёт: Использование понятий модели”;
table.AppendChild(h2);
var br = document.CreateElement(“BR”) as HTMLBRElement;
var h1 = document.CreateElement(“H1”) as HTMLHeadingElement;
h1.TextContent = “Выполнить техпроцесс 1”;
br.AppendChild(h1);
table.AppendChild(br);
document.Body.AppendChild(table);
document.Save(@“d:\job\projects\Report_HTML\files\content\summary.html”);

@AnastasiyaYan

We have logged an investigation ticket as HTMLNET-2778 in our issue tracking system for the sake of your requirements. We will investigate the feasibility and keep you posted with the status of ticket resolution. Please be patient and spare us some time.

We apologize for the inconvenience.