# detect_file_encodings

> **Function** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/document_loaders/helpers/detect_file_encodings)

Try to detect the file encoding.

Returns a list of `FileEncoding` tuples with the detected encodings ordered
by confidence.

## Signature

```python
detect_file_encodings(
    file_path: Union[str, Path],
    timeout: int = 5,
) -> List[FileEncoding]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `file_path` | `Union[str, Path]` | Yes | The path to the file to detect the encoding for. |
| `timeout` | `int` | No | The timeout in seconds for the encoding detection. (default: `5`) |

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/document_loaders/helpers.py#L19)