validates :first_name, :format => {:with => /^(?!\d+$)[a-zA-Z\d][\w'\-\p{Word}\.\&\+ ]+$/i }
In the above code, I have used \p{Word} to pass diacritic as first_name, but get ‘Encoding::CompatibilityError’.
I like to input ‘Fábio Batista’ as first_name, but getting error message “incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)”
Have spend lots of time on it, but unable resolve it.
Environment:
ruby-1.9.2-p180
rails 307
Put
on the first line of your Ruby file.