Charge exchange of hydrogen ions in carbon foils