def safe_read_file(file_path: Path) -> str:
    """Read a text file. Several text encodings are tried until
    the file content is correctly decoded.

    :raise GuesslangError: when the file encoding is not supported
    :param file_path: path to the input file
    :return: text file content
    """
    for encoding in FILE_ENCODINGS:
        try:
            return file_path.read_text(encoding=encoding)
        except UnicodeError:
            pass  # Ignore encoding error

    raise GuesslangError('Encoding not supported for {!s}'.format(file_path))
Read a text file. Several text encodings are tried until
    the file content is correctly decoded.

    :raise GuesslangError: when the file encoding is not supported
    :param file_path: path to the input file
    :return: text file content