"Foreign" languages characters in e-mail addresses

Tom
Posts: 8
Joined: 2010-02-16 09:32

"Foreign" languages characters in e-mail addresses

Post by Tom » 2010-08-09 17:15

I'm currently working on a German website and have ran into a problem with validating e-mail addresses. Apparently letters like ö ä ü are allowed in German e-mail addresses, but MX Form Validation doesn't.
Any ideas?

Cheers,
Tom

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: "Foreign" languages characters in e-mail addresses

Post by Fred » 2010-08-09 20:55

You will have to validate using a regular expression.

This is not only a MX Validation issue, everyone is sitting with the same issues. Even those that uses regex to validate. it is going to become even more of an issue now that you can register domains in the native character-set. Chinese and Russian for example.

Look at this site here for some pointers: http://www.noupe.com/php/php-regular-expressions.html

Maybe something like...
([a-zA-Z0-9\W^@])+([a-zA-Z0-9\._-\W^@])*@([a-zA-Z0-9_-\W^@])+([a-zA-Z0-9\._-\W^@]).([a-zA-Z\W^@])

Where \W matched any non-alphanumeric character.
and the ^@ check for "@" not-in the specific part of the address. (Might not work)

Note: I did not check the expression for validity.

Please post your solution when you are done.

Tom
Posts: 8
Joined: 2010-02-16 09:32

Re: "Foreign" languages characters in e-mail addresses

Post by Tom » 2010-08-10 21:04

Thanks, Fred !
I'll do some experimentation and post any solution I come up with.
Great to be able to ask questions and actually get answers - like in the good old days with InterAkt...

Tom

Post Reply