encoding issue - fixing the minLength and maxLength to support encoding