Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

GroupDocs.Search for .NET allows its users to automatically detect the encoding of each text file that is indexed.
By default, AutoDetectEncoding property is set to false.
The e-Search API detects the following encodings:

...

Encoding can be detected by BOM or by the content of the file (if BOM is not presented).
If encoding is not detected than then UTF8 is used by default.

The Recipe

To detect the encoding of text files, the following steps are needed to be followed:

  • Create an index settings object
  • Enable automatic encoding detection using settings.AutoDetectEncoding = true
  • Create index by passing the index settings beside the index folder path
  • Add documents to index

...

The following snippet shows how to detect the encoding of each text file automatically.

HTML
<script src="https://gist.github.com/GroupDocsGists/05d505d7d681efc93cb24b9a2335fbe7.js"></script>

The following code snippet shows how to detect encoding selectively for some text files.

HTML
<script src="https://gist.github.com/GroupDocsGists/eb5fa13e49b27a3093d638bf0591e47d.js"></script>