problems with utf8 + String class

Ruby String methods assume the string is a single byte per character,
which as you know, is not the case with unicode strings. therefore a
multibyte character in your string is going to throw everything off.
Such is the nature of Ruby.

as a starting point, i suggest you check out: