encoding property

LoadOptions.encoding property

Gets or sets the encoding that will be used to load an HTML, TXT, or CHM document if the encoding is not specified inside the document. Can be null. Default is null.

get encoding(): string

Remarks

This property is used only when loading HTML, TXT, or CHM documents.

If encoding is not specified inside the document and this property is null, then the system will try to automatically detect the encoding.

Examples

Shows how to set the encoding with which to open a document.

let loadOptions = new aw.Loading.LoadOptions();
loadOptions.encoding = "ascii";

// Load the document while passing the LoadOptions object, then verify the document's contents.
let doc = new aw.Document(base.myDir + "English text.txt", loadOptions);

expect(doc.toString(aw.SaveFormat.Text).includes("This is a sample text in English.")).toEqual(true);

See Also