Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Unicode-aware rindex method

#2428

The ActiveSupport::Multibyte::Chars class does not implement a Unicode-aware rindex method, despite claiming that "all the normal String methods are also implemented on the proxy." (I suppose it depends what normal means ;)

This means that rindex is broken in a Unicode environment.

Attached is a patch with tests which implements a Unicode-aware rindex method. I have implemented it in terms of Chars' existing encoding-safe methods.

Reported by Andy Stewart · April 6th, 2009 @ 09:15 AM

State: duplicate
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Jeremy Kemper
    Jeremy Kemper
    • State changed from new to duplicate

    #3028 ActiveSupport::Multibyte::Chars. Unfortunately this ticket was overlooked before putting efforts into a new one!

    August 10th, 2009 @ 07:29 AM

  2. Erik Ostrom
    Erik Ostrom

    This patch no longer applies directly to master (or, the code no longer works, due to a change in the multibyte implementation). In the meantime someone filed a duplicate (#3028) and during the bugmash I wrote a patch for that before noticing this preexisting ticket. Whoops!

    I recommend closing this ticket.

    August 10th, 2009 @ 07:31 AM