Prevent erroneous internal error messages with multibyte characters under ruby 1.8 by using mb_chars for length comparison - it counts multibyte characters.