From: Carlos Date: 2004-12-18T03:54:37+09:00 Subject: Re: utf-8 & Range under eruby (possibly Rails) problems [Johan S�rensen , 2004-12-17 19.34 CET] > On Sat, 18 Dec 2004 03:20:41 +0900, Carlos wrote: > > It is a Ruby feature :). Indices in strings are bytes, not chars. For the > > moment, you must develop your own indexing routines for UTF-8 strings > > (notice that String#[/regex/] works, because regexes are UTF-8 aware). > > I see. > > The thing that has me confused though, is that it's not consistant > since it'll only happen on the first line in the example I gave. > I expand the range a little and it'll pass through untouched. I change > either off the preceeding �'s it'll pass through untouched. Well, because "�".length == 2 (UTF-8 is a multibyte encoding). Your range's end was falling between the two bytes of the "�". --