Open Country Codes: ISO 3166 country names and Alpha-2 country codes in HTML, Python, JavaScript, ActionScript, Flex, JSON, and XML
Introducing Open Country Codes: easy to use ISO 3166 country codes for your apps.
Why are some things just much harder than they need to be? Finding a current, easy-to-use data source for populating a country selection box, for example.
Most of the clean country data out on the web is second-hand, having at one point in time been scraped and tediously hand-converted from the International Organization for Standardization (ISO)'s page of English country names and code elements.
That list "states the country names (official short names in English) in alphabetical order as given in ISO 3166-1 and the corresponding ISO 3166-1-alpha-2 code elements" of 246 countries and is free to use.
Unfortunately, it's an HTML table. Which means that you have some manual data massaging to do if you want to use it. Sucks big time.
ISO also sells the ISO 3166 "database" for about $148 USD. And it comes in -- get this -- Microsoft Access format. I bet we've all got a copy laying around somewhere, right? Oh wait, it's not 1999! So they want to charge you about 60 cents per country name? Not acceptable.
So what's a developer to do? Scrape the site? Write his one-line regular expression to pull out the data? Solve his own problem and move on?
Nah, let's make things better so that other developers don't lose precious time having to jump through ridiculous hoops! :)
Et, voilà, I present to you Open Country Codes.
This simple and deliberately unstyled little app gives you the ISO 3166-1 and ISO 3166-1-alpha-2 country name and country code lists in a variety of ready-to-use formats. There's an HTML country list selection box that you can drop into your page, and pure data structures in Python, JavaScript, ActionScript and a CountryComboBox component for Flex.
There are also JSON and XML feeds that you can use in your applications.
The application pulls in a fresh copy of the list every day and the code samples are dynamically generated.
I hope you find this useful. If you have any suggestions for improving it, please leave me a comment here.
Comments
by Aral on 2008-06-02 18:36:04
by Dan on 2008-06-02 03:02:30
by JB on 2008-06-02 01:15:37
by James Turnbull on 2008-06-03 09:51:17
by Adrian Parr on 2008-06-03 08:53:51
by Edd Parris on 2008-06-02 18:18:22
by Aral on 2008-06-03 16:04:23
by Aral on 2008-06-03 16:10:06
by James Turnbull on 2008-06-01 22:34:16
by jnakai on 2008-06-01 23:09:52
by John on 2008-07-16 00:28:43
by alftuga on 2008-06-02 10:49:06
by Stuart on 2008-06-02 15:55:40
by Dru on 2008-06-01 22:41:06
by Aral on 2008-06-02 13:52:53
by Aral on 2008-06-02 15:00:05
by celil on 2008-06-12 12:23:22
by Cyril Doussin on 2008-06-01 22:30:17
by atom on 2008-06-01 22:26:00
by Ashe Dryden on 2008-06-01 22:38:40
by Murten Saerbi on 2008-06-04 18:05:55
by raxy on 2008-06-19 14:15:24
by Nathan de Vries on 2008-06-02 08:57:54
by Aral on 2008-06-02 16:15:36
by Noel on 2008-06-03 02:32:46
by Robert Ross on 2008-10-31 14:35:59
by Mark Melville on 2009-02-03 18:39:20
by Richy C. on 2008-12-19 14:20:32
by Recent Links Tagged With "3166" - JabberTags on 2008-11-02 14:34:34
by Stuart Herring on 2010-03-10 09:58:19
by Peter Geil on 2010-06-10 17:42:45
by Rens on 2011-07-20 13:19:56
by Petter Palander on 2011-06-10 12:07:39
by Gabri on 2011-10-16 13:30:32
by o_0oo on 2011-12-02 11:55:53
by Tomas Sandven on 2012-01-22 22:43:45