Invalid multibyte output after upgrading to rails 3 and ruby ​​1.9.2 - dtext = '[^ \\ x80]'

I update my application from rails 2 to 3, and when I 'require' this file, which has an email address validator, I get an “invalid multibyte output” error:

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

Any thoughts?

+3
source share
2 answers

Try using:

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

More details about encodings and regexp .

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

+1
source

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

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

. , . https://github.com/saepia/rfc822/blob/master/lib/rfc822.rb

0

Source: https://habr.com/ru/post/1762015/


All Articles