Energy spectra of secondary electrons ejected by ions from foils