Search for a charged Higgs boson in pp collisions at sqrt(s) = 8 TeV