Enforcing maximum tag length by trimming