Encoding

HtmlFixedSaveOptions.Encoding property

يحدد الترميز الذي سيتم استخدامه عند التصدير إلى HTML. القيمة الافتراضية هيترميز UTF8 الجديد (true) (UTF-8 مع BOM).

public Encoding Encoding { get; set; }

أمثلة

يوضح كيفية تعيين الترميز الذي سيتم استخدامه أثناء تصدير مستند إلى HTML.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Writeln("Hello World!");

// الترميز الافتراضي هو UTF-8. إذا أردنا تمثيل مستندنا باستخدام ترميز مختلف،
// يمكننا استخدام كائن SaveOptions لتعيين ترميز معين.
HtmlFixedSaveOptions htmlFixedSaveOptions = new HtmlFixedSaveOptions
{
    Encoding = Encoding.ASCII
};

Assert.AreEqual("US-ASCII", htmlFixedSaveOptions.Encoding.EncodingName);

doc.Save(ArtifactsDir + "HtmlFixedSaveOptions.UseEncoding.html", htmlFixedSaveOptions);

أنظر أيضا