I found a workaround for this:
last = str.mb_chars.length - 1
str.mb_chars[from_index, last].index("a") + from_index
On 15 Dez., 13:56, Peter
<tableYourT...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
wrote:> Hello,
>
> I tried the following
> str ="ÄÄa__"
> assert str.mb_chars.is_utf8?
> assert str.is_utf8?
>
> # this is logical
> assert_equal 4, str.index("a", 4)
>
> # this is not logical. shouldn''t this be nil !?
> assert_equal 2, str.mb_chars.index("a", 4)
>
> Why is the last line failing? And how could I fix this?
>
> Regards,
> Peter.
>
> PS: I am using ruby 1.8.6 on linux with rails 2.2.2
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---