Email validation throws exception with non-ASCII characters #1235

etienne opened this Issue Aug 2, 2011 · 2 comments


None yet

3 participants


When attempting to validate a user with an email containing non-ASCII characters, the following exception is raised:

Encoding::CompatibilityError: incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)

I suspect the problem resides in lib/devise/email.rb, but I wasn't able to provide a fix. I updated one of the existing test cases to trigger the exception (not too sure whether this was supposed to be a pull request, but anyway):



I should add that this only affects Ruby 1.9.


We had the same issue. This is how I by passed this problem, in devise initializer, set (use a regexp satisfying your requirement):

config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
@josevalim josevalim closed this in a8d9695 Aug 29, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment