Charge dependence of pion production in heavy ion collisions