Email validation throws exception with non-ASCII characters #1235

Closed
etienne opened this Issue Aug 2, 2011 · 2 comments

Projects

None yet

3 participants

@etienne

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):

etienne@d891c06

@etienne

I should add that this only affects Ruby 1.9.

@ashchan

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