unicode - Are email addresses allowed to contain non-alphanumeric characters? -


i'm building website using `django. website have significant users non-english speaking countries.

i want know if there technical restrictions on types of characters email address contain.

are email addresses allowed contain english alphabets, numbers, "_", "@" , "."?

are allowed contain non-english alphabets "é" or "ü"?

are allowed contain chinese or japanese or other unicode characters?

email address consists of 2 parts local before @ , domain goes after.

rules these parts different:

for local part can use ascii:

  • latin letters - z - z
  • digits 0 - 9
  • special characters !#$%&'*+-/=?^_`{|}~
  • dot ., not first or last, , not in sequence
  • space , "(),:;<>@[] characters allowed restrictions (they allowed inside quoted string, backslash or double-quote must preceded backslash)
  • plus since 2012 can use international characters above u+007f, encoded as utf-8.

domain part more restricted:

  • latin letters - z - z
  • digits 0 - 9
  • hyphen -, not first or last, multiple hyphens in sequence allowed.

regex validate

^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})

hope saves time.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -