3

I am upgrading my app from rails 2 to 3 and when i 'require' this file that has an email address validator i get an 'invalid multibyte escape' error with:

dtext = '[^\\\\x80]'
pattern = /\A#{dtext}\z/

Any thoughts?

0

2 Answers 2

1

Try using:

pattern = /\A#{dtext}\z/, nil, 'n'

Check out details on encodings and regexp for more.

And I use and recommend this awesome article on encodings in Ruby.

1
0

Modify the rfc822.rb file and change the addr_spec line to the following:

addr_spec = Regexp.new("#{local_part}\\x40#{domain}", nil, 'n')

That should resolve the issue. I got the solution from another gem, see https://github.com/saepia/rfc822/blob/master/lib/rfc822.rb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.