encoding property

FileFormatInfo.encoding property

Gets the detected encoding if applicable to the current document format. At the moment detects encoding only for HTML documents.

get encoding(): string

Examples

Shows how to detect encoding in an html file.

let info = aw.FileFormatUtil.detectFileFormat(base.myDir + "Document.html");

expect(info.loadFormat).toEqual(aw.LoadFormat.Html);

// The Encoding property is used only when we create a FileFormatInfo object for an html document.
const isWindows = process.platform === 'win32';
if (isWindows)
  expect(info.encoding).toEqual("windows-1252");
else
  expect(info.encoding).toEqual("iso-8859-1");

See Also