views:

966

answers:

7

There are examples online with web select boxes that have a huge list of countries and that probably will be good enough for me to use. However, by Murphy's law, there's bound to be some random country that someone is from and isn't on my list (and probably someone else also ran into this and has updated their local list). Also, when new countries are added, I won't know about it.

Basically, I feel it's better practice and a better smell if there is some centralized list of country names that I can use / trust. (also it could set/follow standards for exact namings "United St..." vs "USA" etc.)

I would prefer a solution that isn't IIS specific if possible

+1  A: 

I don't know what IIS is, but ISO 3166 specifies 2-letter codes for each country; AFAIK, their list is comprehensive. ISO 3166 site

Joe Ganley
+10  A: 

They're many list of countries, check this wikipedia article, there you can find some lists like:

And more...

CMS
A: 

The cia world fact book probably does a pretty good job, but they don't list Palestine.

Alex
Look under "O" for "Occupied Palestinian Territories" or "A" for "administered territories". That's another good example of the difficulty of determining "country".
S.Lott
+2  A: 

No list is comprehensive.

"there's bound to be some random country that someone is from and isn't on my list"

If that was all there was to it, it would be simple.

There's no "world law" or "world constitution", so there's no single list of countries, republics, territories, protectorates, autonomous regions, independent governments, and disputed territories.

Indeed, it's not possible to come to an agreed-upon definition of "country" which would lead to a final list of country codes. The definition of "country" is politically charged. What, for example, is Tibet? Country or region of China? Northern Ireland? The Holy See?

Pick a list, and know that it's subject to some dispute.

You could, for example, use the IANA country code database: http://www.iana.org/domains/root/db/

It's as good as any, and since it's part of the IANA, it has some standing as a standard. Further, it's pretty accessible as easy-to-parse web content.

S.Lott
+2  A: 

I have a recent list ready to go on my website at http://www.john.geek.nz/index.php/2009/01/sql-tips-list-of-countries/

It's both at sql and tab delimited - The original list was sourced from wikipedia

John
+1  A: 

This is probably way too late, but there's a web service that you can call that would theoretically allow you to automatically databind your controls: http://www.webservicex.net/country.asmx

May give you another approach and would be better than hard-coding a list yourself.

Phil.Wheeler
+1  A: 

I recommend pulling data out of the Unicode CLDR (Common Locale Data Repository), which include a professionally-maintained list of countries and country name data.

Grab the data from there once, and do updates once in a while; the CLDR data will come in a consistent format, so you won't need to fuss over it once it's part of your workflow.

Anirvan