'Return the file encoding for a path'

def _file_encoding(self, path):

    (status, out, err) = self.git.check_attr(u'encoding', u'--', path)
    if (status != 0):
        return None
    header = (u'%s:    encoding:    ' % path)
    if out.startswith(header):
        encoding = out[len(header):].strip()
        if ((encoding != u'unspecified') and (encoding != u'unset') and (encoding != u'set')):
            return encoding
    return None
