Questions tagged [iso-3166]

A standard published by ISO that defines codes for the names of countries, dependent territories, special areas of geographical interest, and their principal subdivisions (e.g., provinces or states). The official name of the standard is "Codes for the representation of names of countries and their subdivisions".

It consists of three parts:

  • ISO 3166-1, Codes for the representation of names of countries and their subdivisions – Part 1: Country codes, defines codes for the names of countries, dependent territories, and special areas of geographical interest. It defines three sets of country codes:
    • ISO 3166-1 alpha-2 – two-letter country codes which are the most widely used of the three, and used most prominently for the Internet's country code top-level domains (with a few exceptions).
    • ISO 3166-1 alpha-3 – three-letter country codes which allow a better visual association between the codes and the country names than the alpha-2 codes.
    • ISO 3166-1 numeric – three-digit country codes which are identical to those developed and maintained by the United Nations Statistics Division, with the advantage of script (writing system) independence, and hence useful for people or systems using non-Latin scripts.
  • ISO 3166-2, Codes for the representation of names of countries and their subdivisions – Part 2: Country subdivision code, defines codes for the names of the principal subdivisions (e.g., provinces or states) of all countries coded in ISO 3166-1.
  • ISO 3166-3, Codes for the representation of names of countries and their subdivisions – Part 3: Code for formerly used names of countries, defines codes for country names which have been deleted from ISO 3166-1 since its first publication in 1974.
37 questions
96
votes
15 answers

Is there an open source java enum of ISO 3166-1 country codes

Does anyone know of a freely available java 1.5 package that provides a list of ISO 3166-1 country codes as a enum or EnumMap? Specifically I need the "ISO 3166-1-alpha-2 code elements", i.e. the 2 character country code like "us", "uk", "de", etc.…
Jason Jenkins
  • 961
  • 1
  • 7
  • 4
67
votes
1 answer

Is there a good flag icon pack that corresponds to ISO-3166 Country Codes?

I'm in need of an icon pack containing flags that correspond with ISO-3166 country codes such as US, CA, SE, DE etc. Optimally the flag icons would have names such as us.png, ca.png and so on. I'm guessing this is a common developer necessity making…
Hubro
  • 56,214
  • 69
  • 228
  • 381
57
votes
11 answers

How to convert country names to ISO 3166-1 alpha-2 values, using python

I have a list of countries like: countries=['American Samoa', 'Canada', 'France'...] I want to convert them like this: countries=['AS', 'CA', 'FR'...] Is there any module or any way to convert them?
MHS
  • 2,260
  • 11
  • 31
  • 45
22
votes
7 answers

Getting the user's region with navigator.language

For some time, I've been using something like this to get my user's country (ISO-3166): const region = navigator.language.split('-')[1]; // 'US' I've always assumed the string would be similar to en-US -- where the country would hold the 2nd…
Jeff
  • 2,293
  • 4
  • 26
  • 43
9
votes
1 answer

How to get the numeric code of all ISO 3166-1 countries in C#

I need to get the numeric codes of ISO 3166-1 countries in C#. It seems with the RegionInfo class I can only get the Alpha2 and Alpha3 codes. Is it possible to get the ISO 3166-1 numeric codes in C#?
Manuel
  • 1,985
  • 3
  • 31
  • 51
7
votes
4 answers

Country name to ISO 3166-2 code

I know how to convert an ISO 3166-2 code to the full English name, e.g. "US" to "United States" by using RegionInfo. However, how can I do the opposite, i.e. that takes "United States" and returns "US"?
jacobz
  • 3,191
  • 12
  • 37
  • 61
6
votes
5 answers

How to get ISO 3166-1 compatible country code?

I am working on displaying list of timezones by country name. As answered here: Country to timezones in PHP/Zend Framework I am thinking to call DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, 'US') to list all timezones by country. Is…
Krishna Shetty
  • 1,361
  • 4
  • 18
  • 39
3
votes
1 answer

ISO 3166-1 alpha-2 MySQL database with regions

I'm trying to create two different tables with ISO 3166 2 code database for countries and trying to add a custom field with regions (North America, Europe, South America, etc). I've been trying to find out if there is any open project or data with…
pablora
  • 506
  • 1
  • 7
  • 18
3
votes
1 answer

osm overpass query by country

I am using this Overpass query to extract all coworking amenities in Italy. ( area["ISO3166-1"="IT"];) ->.a; node["amenity"="coworking_space"] (area.a); (._;>;); out body; If I try to do the same for France using FR as…
Jacopo
  • 153
  • 1
  • 3
  • 10
3
votes
2 answers

Unsupported ISO 3166 country ES?

My Android app from what I've tested works fine with UK and US locales, but when I change the locale to ES I receive the following error: java.lang.IllegalArgumentException: Unsupported ISO 3166 country: es I've checked ISO 3166 and es is definitely…
KingFu
  • 1,358
  • 5
  • 22
  • 42
2
votes
1 answer

Java Locale to country codes (ISO 3166)

I have an instance of Locale, for example: Locale l = new Locale("en", "USA"); Now, I want to get the locale in the ISO 3166 format en-US. When I toString it though, I only get en_USA but not en-US. How to do this correctly?
Deepesh kumar Gupta
  • 884
  • 2
  • 11
  • 29
2
votes
0 answers

How to convert ISO 3166-1 values to country name, using kotlin

I have countries like: country = RUS I want to convert like this: country = Russia Is there any way to convert?
Reaf
  • 51
  • 5
2
votes
0 answers

Is there a function in Swift to get the ISO 3166-2 codes (provinces, states) for a country?

For an app I need the users to create addresses. It is important that the addresses are valid and include an ISO 3166 ALPHA-2 country code as well as an ISO 3166-2 code for the province, state, etc. I can use NSLocale to get all country codes and…
Dennis
  • 200
  • 15
2
votes
2 answers

How to get ISO 3166 Country Code from CultureInfo in .NET

Given a CultureInfo object, how do I get the two character ISO 3166 Country Code? E.g. from en-US, I want US and from en-GB, I want GB. I also need to handle cases where the culture may not have a country code.
Muhammad Rehan Saeed
  • 35,627
  • 39
  • 202
  • 311
2
votes
2 answers

ISO 3166-1 to woeid

Where do I find a list of all countries woeid from their ISO 3166-1 alpha2 or alpha3 codes?
Muleskinner
  • 14,150
  • 19
  • 58
  • 79
1
2 3