Skip to main content

TdxHtmlDocumentImporterOptions.Encoding Property

Specifies the character encoding used to interpret characters in an imported HTML document.

Declaration

property Encoding: Word read; write; default CP_UTF8;

Property Value

Type Default Description
Word CP_UTF8

The target character encoding.

Remarks

Use the Encoding property to specify the target character encoding explicitly when the AutoDetectEncoding property is set to False.

Code Example: Use UTF-7 to Import HTML Documents

The following code example defines the UTF-7 encoding to load an HTML document:

uses
  dxRichEdit.DocumentServer,  // Declares the TdxRichEditDocumentServer component
  dxRichEdit.Html;  // Declares HTML format implementation

// ...

var
  ADocumentServer: TdxRichEditDocumentServer;
begin
  ADocumentServer := TdxRichEditDocumentServer.Create(nil);
  try
    ADocumentServer.Options.Import.Html.AutoDetectEncoding := False;
    ADocumentServer.Options.Import.Html.Encoding := CP_UTF7;
    ADocumentServer.LoadDocument('Document1.html');
    // Your document processing code
  finally
    ADocumentServer.Free;
  end;
end;

Default Value

The Encoding property’s default value is CP_UTF8.

See Also