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.

Bug in Regexp using extended characters

#1017

All of the following examples work as expected in IRB but fail in the rails console environment when the character is greater then 191. However, it works fine if you escape using the octal representation of the character Regexp.new(218.chr) will break but /\332/ is fine ( /\332/===218.chr => true )

Regexp.new('^'+65.chr+'$') === 65.chr => true Regexp.new('^'+218.chr+'$') === 218.chr => false

Regexp.new(65.chr) => /A/ c=191; Regexp.new('^'+c.chr+'$') === c.chr => true c=192; Regexp.new('^'+c.chr+'$') === c.chr false Regexp.new 190.chr /\276/ Regexp.new 193.chr RegexpError: premature end of regular expression: /Á/ from (irb):54:in initialize' from (irb):54:innew' from (irb):54

Regexp.new(218.chr) RegexpError: premature end of regular expression: /Ú/ from (irb):237:in initialize' from (irb):237:innew' from (irb):237 from :0

rails --version => Rails 2.1.0 RUBY_VERSION => "1.8.6" RUBY_RELEASE_DATE => "2008-08-11" RUBY_PLATFORM => "i686-darwin8.11.1"

Reported by Joshaven Potter · September 11th, 2008 @ 02:25 AM

State: invalid
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Pratik
    Pratik
    • Assigned user set to Pratik
    • State changed from new to invalid

    Could you please submit a failing test case/fix - http://rails.lighthouseapp.com/p... ?

    Thanks.

    December 20th, 2008 @ 05:36 PM