Filter control chars illegal in XML1.0 (bnc#850907)
Fix loop size in previous patch (bnc#850907)