DetectEncoding
Contents
[
Hide
]
DetectEncoding(string)
Attempts to detect text TXT, TSV, and CSV files encoding by path.
public static Encoding DetectEncoding(string filePath)
| Parameter | Type | Description |
|---|---|---|
| filePath | String | The file name or file path. |
Return Value
Encoding or null when fails to detect a file encoding.
Examples
The example demonstrates how to detect text file encoding.
Encoding encoding = FileType.DetectEncoding("message.txt");
See Also
- class FileType
- namespace GroupDocs.Viewer
- assembly GroupDocs.Viewer
DetectEncoding(Stream)
Attempts to detect text TXT, TSV, and CSV file encoding by stream.
public static Encoding DetectEncoding(Stream stream)
| Parameter | Type | Description |
|---|---|---|
| stream | Stream | The file stream. |
Return Value
Encoding or null when fails to detect a file encoding.
Examples
The example demonstrates how to detect text file encoding.
Stream stream = File.OpenRead("message.txt");
Encoding encoding = FileType.DetectEncoding(stream);
See Also
- class FileType
- namespace GroupDocs.Viewer
- assembly GroupDocs.Viewer