Encoding

HtmlFixedSaveOptions.Encoding property

Spécifie l’encodage à utiliser lors de l’exportation au format HTML. La valeur par défaut estnouveau UTF8Encoding(true) (UTF-8 avec BOM).

public Encoding Encoding { get; set; }

Exemples

Montre comment définir l’encodage à utiliser lors de l’exportation d’un document au format HTML.

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

builder.Writeln("Hello World!");

// L'encodage par défaut est UTF-8. Si nous souhaitons représenter notre document avec un encodage différent,
// nous pouvons utiliser un objet SaveOptions pour définir un encodage spécifique.
HtmlFixedSaveOptions htmlFixedSaveOptions = new HtmlFixedSaveOptions
{
    Encoding = Encoding.ASCII
};

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

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

Voir également