validate length of $character