How to store international addresses?

730 views
Skip to first unread message

Ben Johnson

unread,
Oct 25, 2006, 3:02:00 PM10/25/06
to rubyonra...@googlegroups.com
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.

--
Posted via http://www.ruby-forum.com/.

Jakob Skjerning

unread,
Oct 25, 2006, 3:58:53 PM10/25/06
to rubyonra...@googlegroups.com

On Oct 25, 2006, at 21:02, Ben Johnson 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 Skjerning - http://mentalized.net

Richard Conroy

unread,
Oct 26, 2006, 1:11:05 PM10/26/06
to rubyonra...@googlegroups.com

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

Ben Johnson

unread,
Oct 26, 2006, 1:24:34 PM10/26/06
to rubyonra...@googlegroups.com

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.

Daniel Butler

unread,
Oct 26, 2006, 2:16:45 PM10/26/06
to rubyonra...@googlegroups.com
You might also want to read "Frank's Compulsive Guide to Postal Addresses", which I have found helpful.

http://www.columbia.edu/kermit/postal.html

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
http://www.yup.com

snacktime

unread,
Oct 26, 2006, 3:13:32 PM10/26/06
to rubyonra...@googlegroups.com
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.
Reply all
Reply to author
Forward
0 new messages