views:

51

answers:

2

I know email addresses are limited to 254 characters, but is there a single resource that outlines suggested maxlengths for common fields like contact information e.g. phone, city, etc?

It seems every project I work people just shoot from the hip on their proposed limits. I'm hoping to find a canonical reference, targeted to a specific country.

Edit - Updated email maxlength per comment.

A: 

First of all, unless you are using a specific program that is limiting your emails their is no reason why it cannot be longer than 320 characters. What type of script are you using to push inputs to email?

Second, I've never seen a specific reference online but most developers I've worked with will limit textfields such as phone, email, name to 50 characters. Many times textareas will not have limits, but I always recommend 250-300 characters, sometime shorter depending on the type of response you're expecting.

s_broderick
There is a hard limit on email address length per RFC2821 - http://www.ietf.org/rfc/rfc2821.txt. 64 chars for the local portion (before the @) and 255 after the @. So 320 is the max length.
Cory House
yes, I'm sorry. For email addresses their is a standard limit. I thought you were talking about the email as a whole.
s_broderick
+1  A: 

I just found that the HR-XML Consortium posted their standards. Perhaps there is something in their download that addresses things like this.

http://www.hr-xml.org/hr-xml/wms/hr-xml-1-org/index.php?id={E00DA03B685A0DD18FB6A08AF0923DE0|139|2}

-- Original -- I've run into this problem before, after starting on any new project. And my answer here is just based off experience. I don't think there is a canonical reference. If you already have existing data, you could run a report and see what the max length is for any of the fields and add some padding. If you are going to be getting data from more than one country, then the max length may change based on the country.

Even if there was a canonical list based on country, it wouldn't be enough, because there exists > 1 language and culture in most countries, each possibly having their own "normal" lengths for each of the fields you are talking about.

Some common sense we apply: we usually cut off the address fields at 50. Why? well, I can't imagine anyone having an address that has 50 characters on it (how could you possibly fit that onto an envelope).

For things like phone numbers, we break it out and give the country and city codes their own fields, as well as for area codes. Then we cap the phone numbers at 15. Again, I've never seen a phone number (with all of the other stuff left out) > 15.

For the same reason, if you break up the name fields into first name/last name, you probably don't need 50 chars, 35 might suffice.

NinjaCat
I've used previous data as a benchmark too, and I agree, if you have previous data that's really the best approach. And your common sense limits are similar to mine. I've just seen some people be (in my opinion) overly restrictive so it would be nice to have a trusted reference.
Cory House
Monster.com used to publish their schema... but I've looked for a good hour today and can't find it anywhere.
NinjaCat