# How to store international addresses?

**URL:** <https://www.ruby-forum.com/t/how-to-store-international-addresses/73630>\
**Category:** Rails\
**Created:** [October 25, 2006, 9:02pm UTC](https://www.ruby-forum.com/t/how-to-store-international-addresses/73630 "2006-10-25T21:02:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [October 25, 2006, 9:02pm UTC](https://www.ruby-forum.com/t/how-to-store-international-addresses/73630/1 "2006-10-25T21:02:00Z")

</div>

How do you store international addresses in a database? What fields do  
you need? I have no idea what addresses are like all over the world. Is  
there a guide for this? Documentation?

As you can see I’m kind of lost as to where to start, so any help is  
greatly appreciated.

Thanks.

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [October 25, 2006, 10:00pm UTC](https://www.ruby-forum.com/t/how-to-store-international-addresses/73630/2 "2006-10-25T22:00:40Z")

</div>

On Oct 25, 2006, at 21:02, Ben J. wrote:

> How do you store international addresses in a database? What fields do  
> you need? I have no idea what addresses are like all over the world.

I suppose it depends on what you need them for. Basically all you  
need is one field in the database and a text area in your UI. I don’t  
know of any address that won’t fit into that schema.

–  
Jakob S. - [http://mentalized.net](http://mentalized.net)

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [October 26, 2006, 7:20pm UTC](https://www.ruby-forum.com/t/how-to-store-international-addresses/73630/3 "2006-10-26T19:20:24Z")

</div>

On 10/25/06, Jakob S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Oct 25, 2006, at 21:02, Ben J. wrote:
> 
> > How do you store international addresses in a database? What fields do  
> > you need? I have no idea what addresses are like all over the world.
> 
> I suppose it depends on what you need them for. Basically all you  
> need is one field in the database and a text area in your UI. I don’t  
> know of any address that won’t fit into that schema.

About the only thing that really changes much is that not every  
country has a ZIP code or equivalent.

Having 3-4 lines for an address or just a text field is normally  
sufficient,  
but you do want to be capturing concepts like City/State (though  
allowing for the fact that different countries have different names for  
their primary geographic administrations, like province, county,  
prefecture).

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [October 26, 2006, 8:24pm UTC](https://www.ruby-forum.com/t/how-to-store-international-addresses/73630/4 "2006-10-26T20:24:35Z")

</div>

You might also want to read “Frank’s Compulsive Guide to Postal  
Addresses”,  
which I have found helpful.

> **[FRANK'S COMPULSIVE GUIDE TO POSTAL ADDRESSES](http://www.columbia.edu/~fdc/postal/)**
>
> International postal addessing, address formats, and rules. How
> to address postal mail that is sent from the United States to other
> countries, with details for each country, sometimes also history and
> anecdotes, and links to the postal...

To summarize: it’s really difficult. Unless you need to separate fields  
like  
city, state, postal code, or country for analytical purposes, the text  
area  
solution will hold an address of any format.

Daniel

> **[Yup Online Math Tutoring Service - Math Tutoring Website](https://yup.com)**
>
> Yup is your math teacher multiplier. We provide secure access to
> expert math tutors 24/7, powering High-Dosage Tutoring in and out of the
> classroom. Our "Math Learning Support System" gives teachers extra capacity,
> actionable data, and is...

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [October 26, 2006, 7:24pm UTC](https://www.ruby-forum.com/t/how-to-store-international-addresses/73630/5 "2006-10-26T19:24:34Z")

</div>

Richard C. wrote:

> On 10/25/06, Jakob S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > On Oct 25, 2006, at 21:02, Ben J. wrote:
> > 
> > > How do you store international addresses in a database? What fields do  
> > > you need? I have no idea what addresses are like all over the world.
> > 
> > I suppose it depends on what you need them for. Basically all you  
> > need is one field in the database and a text area in your UI. I don’t  
> > know of any address that won’t fit into that schema.
> 
> About the only thing that really changes much is that not every  
> country has a ZIP code or equivalent.
> 
> Having 3-4 lines for an address or just a text field is normally  
> sufficient,  
> but you do want to be capturing concepts like City/State (though  
> allowing for the fact that different countries have different names for  
> their primary geographic administrations, like province, county,  
> prefecture).

Thanks for the help. I looked on Amazon to see how they did it and they  
have it set up just like the US address with a country select box.  
Basically they called the state textbox “State/Province/Region” and the  
zip textbox “Zip/Postal Code”. I’m assuming that should be correct since  
Amazon does it.

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [October 26, 2006, 9:28pm UTC](https://www.ruby-forum.com/t/how-to-store-international-addresses/73630/6 "2006-10-26T21:28:42Z")

</div>

Just do it like Amazon does it and use name combinations to label the  
fields like postal/zip code state/region, etc… Most post offices  
are pretty good about delivery even if things don’t all get on the  
right lines. For example some places might have a region, district,  
city, and postal code, but most people will just put the  
region/district or district/city together and it works. Just be  
careful to give ample room for input fields and don’t make them all  
required unless you know the rules for the country in question. For  
example some places still don’t have postal codes.
