Analyses and the effect of impurities contained in charge stripper foils for the 3-GeV RCS of J-PARC