DetectEncoding
Leave feedback
On this page
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. |
Encoding or null when fails to detect a file encoding.
The example demonstrates how to detect text file encoding.
Encoding encoding = FileType.DetectEncoding("message.txt");
- class FileType
- namespace GroupDocs.Viewer
- assembly GroupDocs.Viewer
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. |
Encoding or null when fails to detect a file encoding.
The example demonstrates how to detect text file encoding.
Stream stream = File.OpenRead("message.txt");
Encoding encoding = FileType.DetectEncoding(stream);
- class FileType
- namespace GroupDocs.Viewer
- assembly GroupDocs.Viewer
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.