This project is archived and is in readonly mode.

#1017 ✓invalid
Joshaven Potter

Bug in Regexp using extended characters

Reported by Joshaven Potter | September 11th, 2008 @ 02:25 AM | in 2.x

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"

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Tags

Pages