detect_file_encodings#

langchain_community.document_loaders.helpers.detect_file_encodings(file_path: str | Path, timeout: int = 5) List[FileEncoding][source]#

Try to detect the file encoding.

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

Parameters:
  • file_path (str | Path) – The path to the file to detect the encoding for.

  • timeout (int) – The timeout in seconds for the encoding detection.

Return type:

List[FileEncoding]