Charged pion-pair photoproduction and electroproduction on the proton up to 1 GeV