def METHOD_NAME(path):
    encoding = 'UTF-8'
    last_line = "\n"
    whitespace_errors = set()
    tab_errors = set()
    try:
        with open(path, 'r') as f:
            whitespace_errors, last_line = check_trailing_whitespace(f)
    except UnicodeDecodeError:
        encoding = 'ISO-8859-1'
        try:
            with open(path, 'r', encoding=encoding) as f:
                whitespace_errors, last_line = check_trailing_whitespace(f)
        except Exception:
            encoding = 'unknown'
    try:
        with open(path, 'r') as f:
            tab_errors = check_tabs(f)
    except UnicodeDecodeError:
        encoding = 'ISO-8859-1'
        try:
            with open(path, 'r', encoding=encoding) as f:
                tab_errors = check_tabs(f)
        except Exception:
            encoding = 'unknown'
    return {
        'tab_errors': tab_errors,
        'whitespace_errors': whitespace_errors,
        'encoding': encoding,
        'eof_error': not last_line.endswith('\n')
    }