A water-soluble copolymer comprising, by mass relative to the total mass of the copolymer:1 to 40% of at least one cationic monomer;59.99 to 98% of at least one nonionic monomer;0.01 to 10% of at least one monomer of formula (I);in which:R1 is a hydrogen atom or a methyl radical;Z is a divalent group —C(═O)—O—, or —C(═O)—NH—;n is an integer between 2 and 200;R2 is a hydrogen atom or a carbon-containing radical which is saturated or unsaturated, optionally aromatic, linear, branched or cyclic, comprising 1 to 30 carbon atoms, and from 0 to 4 heteroatoms chosen from the group comprising O, N and S;the copolymer having a cationic charge density between 0.05 and 3 meq/g.