List of phone number country codes

匿名 (未验证) 提交于 2019-12-03 02:50:02

问题:

On this Wikipedia entry I found out that ITU Telecommunication Standardization Sector (ITU-T) is providing such list of country calling codes.

Here is a pdf: http://www.itu.int/dms_pub/itu-t/opb/sp/T-SP-E.164D-2009-PDF-E.pdf

I wonder where to find this in a xml file or similar? I need to do find out which country a phone number is from, both in javascript and c#.

回答1:

There is an Excel file with regexps here. You can easily "convert" it to XML and you will be able to determine country by the full phone number.

UPD: The file that I referenced 4 years ago is no longer accessible. I would recommend using Google's libphonenumber.

The answer to Extract code country from phone number [libphonenumber] will show you the proper way to receive country code from a phone number.



回答2:

I generated json file in the following format (Hope that it will help you) :

{   "countries": [     {       "code": "+7 840",       "name": "Abkhazia"     },     {       "code": "+93",       "name": "Afghanistan"     },     {       "code": "+355",       "name": "Albania"     },     {       "code": "+213",       "name": "Algeria"     },     {       "code": "+1 684",       "name": "American Samoa"     },     {       "code": "+376",       "name": "Andorra"     },     {       "code": "+244",       "name": "Angola"     },     {       "code": "+1 264",       "name": "Anguilla"     },     {       "code": "+1 268",       "name": "Antigua and Barbuda"     },     {       "code": "+54",       "name": "Argentina"     },     {       "code": "+374",       "name": "Armenia"     },     {       "code": "+297",       "name": "Aruba"     },     {       "code": "+247",       "name": "Ascension"     },     {       "code": "+61",       "name": "Australia"     },     {       "code": "+672",       "name": "Australian External Territories"     },     {       "code": "+43",       "name": "Austria"     },     {       "code": "+994",       "name": "Azerbaijan"     },     {       "code": "+1 242",       "name": "Bahamas"     },     {       "code": "+973",       "name": "Bahrain"     },     {       "code": "+880",       "name": "Bangladesh"     },     {       "code": "+1 246",       "name": "Barbados"     },     {       "code": "+1 268",       "name": "Barbuda"     },     {       "code": "+375",       "name": "Belarus"     },     {       "code": "+32",       "name": "Belgium"     },     {       "code": "+501",       "name": "Belize"     },     {       "code": "+229",       "name": "Benin"     },     {       "code": "+1 441",       "name": "Bermuda"     },     {       "code": "+975",       "name": "Bhutan"     },     {       "code": "+591",       "name": "Bolivia"     },     {       "code": "+387",       "name": "Bosnia and Herzegovina"     },     {       "code": "+267",       "name": "Botswana"     },     {       "code": "+55",       "name": "Brazil"     },     {       "code": "+246",       "name": "British Indian Ocean Territory"     },     {       "code": "+1 284",       "name": "British Virgin Islands"     },     {       "code": "+673",       "name": "Brunei"     },     {       "code": "+359",       "name": "Bulgaria"     },     {       "code": "+226",       "name": "Burkina Faso"     },     {       "code": "+257",       "name": "Burundi"     },     {       "code": "+855",       "name": "Cambodia"     },     {       "code": "+237",       "name": "Cameroon"     },     {       "code": "+1",       "name": "Canada"     },     {       "code": "+238",       "name": "Cape Verde"     },     {       "code": "+ 345",       "name": "Cayman Islands"     },     {       "code": "+236",       "name": "Central African Republic"     },     {       "code": "+235",       "name": "Chad"     },     {       "code": "+56",       "name": "Chile"     },     {       "code": "+86",       "name": "China"     },     {       "code": "+61",       "name": "Christmas Island"     },     {       "code": "+61",       "name": "Cocos-Keeling Islands"     },     {       "code": "+57",       "name": "Colombia"     },     {       "code": "+269",       "name": "Comoros"     },     {       "code": "+242",       "name": "Congo"     },     {       "code": "+243",       "name": "Congo, Dem. Rep. of (Zaire)"     },     {       "code": "+682",       "name": "Cook Islands"     },     {       "code": "+506",       "name": "Costa Rica"     },     {       "code": "+385",       "name": "Croatia"     },     {       "code": "+53",       "name": "Cuba"     },     {       "code": "+599",       "name": "Curacao"     },     {       "code": "+537",       "name": "Cyprus"     },     {       "code": "+420",       "name": "Czech Republic"     },     {       "code": "+45",       "name": "Denmark"     },     {       "code": "+246",       "name": "Diego Garcia"     },     {       "code": "+253",       "name": "Djibouti"     },     {       "code": "+1 767",       "name": "Dominica"     },     {       "code": "+1 809",       "name": "Dominican Republic"     },     {       "code": "+670",       "name": "East Timor"     },     {       "code": "+56",       "name": "Easter Island"     },     {       "code": "+593",       "name": "Ecuador"     },     {       "code": "+20",       "name": "Egypt"     },     {       "code": "+503",       "name": "El Salvador"     },     {       "code": "+240",       "name": "Equatorial Guinea"     },     {       "code": "+291",       "name": "Eritrea"     },     {       "code": "+372",       "name": "Estonia"     },     {       "code": "+251",       "name": "Ethiopia"     },     {       "code": "+500",       "name": "Falkland Islands"     },     {       "code": "+298",       "name": "Faroe Islands"     },     {       "code": "+679",       "name": "Fiji"     },     {       "code": "+358",       "name": "Finland"     },     {       "code": "+33",       "name": "France"     },     {       "code": "+596",       "name": "French Antilles"     },     {       "code": "+594",       "name": "French Guiana"     },     {       "code": "+689",       "name": "French Polynesia"     },     {       "code": "+241",       "name": "Gabon"     },     {       "code": "+220",       "name": "Gambia"     },     {       "code": "+995",       "name": "Georgia"     },     {       "code": "+49",       "name": "Germany"     },     {       "code": "+233",       "name": "Ghana"     },     {       "code": "+350",       "name": "Gibraltar"     },     {       "code": "+30",       "name": "Greece"     },     {       "code": "+299",       "name": "Greenland"     },     {       "code": "+1 473",       "name": "Grenada"     },     {       "code": "+590",       "name": "Guadeloupe"     },     {       "code": "+1 671",       "name": "Guam"     },     {       "code": "+502",       "name": "Guatemala"     },     {       "code": "+224",       "name": "Guinea"     },     {       "code": "+245",       "name": "Guinea-Bissau"     },     {       "code": "+595",       "name": "Guyana"     },     {       "code": "+509",       "name": "Haiti"     },     {       "code": "+504",       "name": "Honduras"     },     {       "code": "+852",       "name": "Hong Kong SAR China"     },     {       "code": "+36",       "name": "Hungary"     },     {       "code": "+354",       "name": "Iceland"     },     {       "code": "+91",       "name": "India"     },     {       "code": "+62",       "name": "Indonesia"     },     {       "code": "+98",       "name": "Iran"     },     {       "code": "+964",       "name": "Iraq"     },     {       "code": "+353",       "name": "Ireland"     },     {       "code": "+972",       "name": "Israel"     },     {       "code": "+39",       "name": "Italy"     },     {       "code": "+225",       "name": "Ivory Coast"     },     {       "code": "+1 876",       "name": "Jamaica"     },     {       "code": "+81",       "name": "Japan"     },     {       "code": "+962",       "name": "Jordan"     },     {       "code": "+7 7",       "name": "Kazakhstan"     },     {       "code": "+254",       "name": "Kenya"     },     {       "code": "+686",       "name": "Kiribati"     },     {       "code": "+965",       "name": "Kuwait"     },     {       "code": "+996",       "name": "Kyrgyzstan"     },     {       "code": "+856",       "name": "Laos"     },     {       "code": "+371",       "name": "Latvia"     },     {       "code": "+961",       "name": "Lebanon"     },     {       "code": "+266",       "name": "Lesotho"     },     {       "code": "+231",       "name": "Liberia"     },     {       "code": "+218",       "name": "Libya"     },     {       "code": "+423",       "name": "Liechtenstein"     },     {       "code": "+370",       "name": "Lithuania"     },     {       "code": "+352",       "name": "Luxembourg"     },     {       "code": "+853",       "name": "Macau SAR China"     },     {       "code": "+389",       "name": "Macedonia"     },     {       "code": "+261",       "name": "Madagascar"     },     {       "code": "+265",       "name": "Malawi"     },     {       "code": "+60",       "name": "Malaysia"     },     {       "code": "+960",       "name": "Maldives"     },     {       "code": "+223",       "name": "Mali"     },     {       "code": "+356",       "name": "Malta"     },     {       "code": "+692",       "name": "Marshall Islands"     },     {       "code": "+596",       "name": "Martinique"     },     {       "code": "+222",       "name": "Mauritania"     },     {       "code": "+230",       "name": "Mauritius"     },     {       "code": "+262",       "name": "Mayotte"     },     {       "code": "+52",       "name": "Mexico"     },     {       "code": "+691",       "name": "Micronesia"     },     {       "code": "+1 808",       "name": "Midway Island"     },     {       "code": "+373",       "name": "Moldova"     },     {       "code": "+377",       "name": "Monaco"     },     {       "code": "+976",       "name": "Mongolia"     },     {       "code": "+382",       "name": "Montenegro"     },     {       "code": "+1664",       "name": "Montserrat"     },     {       "code": "+212",       "name": "Morocco"     },     {       "code": "+95",       "name": "Myanmar"     },     {       "code": "+264",       "name": "Namibia"     },     {       "code": "+674",       "name": "Nauru"     },     {       "code": "+977",       "name": "Nepal"     },     {       "code": "+31",       "name": "Netherlands"     },     {       "code": "+599",       "name": "Netherlands Antilles"     },     {       "code": "+1 869",       "name": "Nevis"     },     {       "code": "+687",       "name": "New Caledonia"     },     {       "code": "+64",       "name": "New Zealand"     },     {       "code": "+505",       "name": "Nicaragua"     },     {       "code": "+227",       "name": "Niger"     },     {       "code": "+234",       "name": "Nigeria"     },     {       "code": "+683",       "name": "Niue"     },     {       "code": "+672",       "name": "Norfolk Island"     },     {       "code": "+850",       "name": "North Korea"     },     {       "code": "+1 670",       "name": "Northern Mariana Islands"     },     {       "code": "+47",       "name": "Norway"     },     {       "code": "+968",       "name": "Oman"     },     {       "code": "+92",       "name": "Pakistan"     },     {       "code": "+680",       "name": "Palau"     },     {       "code": "+970",       "name": "Palestinian Territory"     },     {       "code": "+507",       "name": "Panama"     },     {       "code": "+675",       "name": "Papua New Guinea"     },     {       "code": "+595",       "name": "Paraguay"     },     {       "code": "+51",       "name": "Peru"     },     {       "code": "+63",       "name": "Philippines"     },     {       "code": "+48",       "name": "Poland"     },     {       "code": "+351",       "name": "Portugal"     },     {       "code": "+1 787",       "name": "Puerto Rico"     },     {       "code": "+974",       "name": "Qatar"     },     {       "code": "+262",       "name": "Reunion"     },     {       "code": "+40",       "name": "Romania"     },     {       "code": "+7",       "name": "Russia"     },     {       "code": "+250",       "name": "Rwanda"     },     {       "code": "+685",       "name": "Samoa"     },     {       "code": "+378",       "name": "San Marino"     },     {       "code": "+966",       "name": "Saudi Arabia"     },     {       "code": "+221",       "name": "Senegal"     },     {       "code": "+381",       "name": "Serbia"     },     {       "code": "+248",       "name": "Seychelles"     },     {       "code": "+232",       "name": "Sierra Leone"     },     {       "code": "+65",       "name": "Singapore"     },     {       "code": "+421",       "name": "Slovakia"     },     {       "code": "+386",       "name": "Slovenia"     },     {       "code": "+677",       "name": "Solomon Islands"     },     {       "code": "+27",       "name": "South Africa"     },     {       "code": "+500",       "name": "South Georgia and the South Sandwich Islands"     },     {       "code": "+82",       "name": "South Korea"     },     {       "code": "+34",       "name": "Spain"     },     {       "code": "+94",       "name": "Sri Lanka"     },     {       "code": "+249",       "name": "Sudan"     },     {       "code": "+597",       "name": "Suriname"     },     {       "code": "+268",       "name": "Swaziland"     },     {       "code": "+46",       "name": "Sweden"     },     {       "code": "+41",       "name": "Switzerland"     },     {       "code": "+963",       "name": "Syria"     },     {       "code": "+886",       "name": "Taiwan"     },     {       "code": "+992",       "name": "Tajikistan"     },     {       "code": "+255",       "name": "Tanzania"     },     {       "code": "+66",       "name": "Thailand"     },     {       "code": "+670",       "name": "Timor Leste"     },     {       "code": "+228",       "name": "Togo"     },     {       "code": "+690",       "name": "Tokelau"     },     {       "code": "+676",       "name": "Tonga"     },     {       "code": "+1 868",       "name": "Trinidad and Tobago"     },     {       "code": "+216",       "name": "Tunisia"     },     {       "code": "+90",       "name": "Turkey"     },     {       "code": "+993",       "name": "Turkmenistan"     },     {       "code": "+1 649",       "name": "Turks and Caicos Islands"     },     {       "code": "+688",       "name": "Tuvalu"     },     {       "code": "+1 340",       "name": "U.S. Virgin Islands"     },     {       "code": "+256",       "name": "Uganda"     },     {       "code": "+380",       "name": "Ukraine"     },     {       "code": "+971",       "name": "United Arab Emirates"     },     {       "code": "+44",       "name": "United Kingdom"     },     {       "code": "+1",       "name": "United States"     },     {       "code": "+598",       "name": "Uruguay"     },     {       "code": "+998",       "name": "Uzbekistan"     },     {       "code": "+678",       "name": "Vanuatu"     },     {       "code": "+58",       "name": "Venezuela"     },     {       "code": "+84",       "name": "Vietnam"     },     {       "code": "+1 808",       "name": "Wake Island"     },     {       "code": "+681",       "name": "Wallis and Futuna"     },     {       "code": "+967",       "name": "Yemen"     },     {       "code": "+260",       "name": "Zambia"     },     {       "code": "+255",       "name": "Zanzibar"     },     {       "code": "+263",       "name": "Zimbabwe"     }   ] }


回答3:

You can get a JSON file that maps country codes to phone codes from http://country.io/phone.json:

... BD: "880", BE: "32", BF: "226", BG: "359", BA: "387", ...

If you want country names then http://country.io/names.json will give you that:

... "AL": "Albania", "AM": "Armenia", "AO": "Angola", "AQ": "Antarctica", "AR": "Argentina", ...

See http://country.io/data for more details.



回答4:

There is a fairly well maintained repo on github that has a CSV (with semicolon delimiters), XML, and JSON source of countries, country codes, and other information.



回答5:

Rather than trying to roll your own logic for determining the country code of a phone number, I highly recommend using Google's libphonenumber project. This project is very extensive and well maintained, and has been ported to a several languages.



回答6:

You can easily convert to xml format using online converters:

I have converted the list:

      +7 840     Abkhazia       +93     Afghanistan       +355     Albania       +213     Algeria       +1 684     American Samoa       +376     Andorra       +244     Angola       +1 264     Anguilla       +1 268     Antigua and Barbuda       +54     Argentina       +374     Armenia       +297     Aruba       +247     Ascension       +61     Australia       +672     Australian External Territories       +43     Austria       +994     Azerbaijan       +1 242     Bahamas       +973     Bahrain       +880     Bangladesh       +1 246     Barbados       +1 268     Barbuda       +375     Belarus       +32     Belgium       +501     Belize       +229     Benin       +1 441     Bermuda       +975     Bhutan       +591     Bolivia       +387     Bosnia and Herzegovina       +267     Botswana       +55     Brazil       +246     British Indian Ocean Territory       +1 284     British Virgin Islands       +673     Brunei       +359     Bulgaria       +226     Burkina Faso       +257     Burundi       +855     Cambodia       +237     Cameroon       +1     Canada       +238     Cape Verde       + 345     Cayman Islands       +236     Central African Republic       +235     Chad       +56     Chile       +86     China       +61     Christmas Island       +61     Cocos-Keeling Islands       +57     Colombia       +269     Comoros       +242     Congo       +243     Congo, Dem. Rep. of (Zaire)       +682     Cook Islands       +506     Costa Rica       +385     Croatia       +53     Cuba       +599     Curacao       +537     Cyprus       +420     Czech Republic       +45     Denmark       +246     Diego Garcia       +253     Djibouti       +1 767     Dominica       +1 809     Dominican Republic       +670     East Timor       +56     Easter Island       +593     Ecuador       +20     Egypt       +503     El Salvador       +240     Equatorial Guinea       +291     Eritrea       +372     Estonia       +251     Ethiopia       +500     Falkland Islands       +298     Faroe Islands       +679     Fiji       +358     Finland       +33     France       +596     French Antilles       +594     French Guiana       +689     French Polynesia       +241     Gabon       +220     Gambia       +995     Georgia       +49     Germany       +233     Ghana       +350     Gibraltar       +30     Greece       +299     Greenland       +1 473     Grenada       +590     Guadeloupe       +1 671     Guam       +502     Guatemala       +224     Guinea       +245     Guinea-Bissau       +595     Guyana       +509     Haiti       +504     Honduras       +852     Hong Kong SAR China       +36     Hungary       +354     Iceland       +91     India       +62     Indonesia       +98     Iran       +964     Iraq       +353     Ireland       +972     Israel       +39     Italy       +225     Ivory Coast       +1 876     Jamaica       +81     Japan       +962     Jordan       +7 7     Kazakhstan       +254     Kenya       +686     Kiribati       +965     Kuwait       +996     Kyrgyzstan       +856     Laos       +371     Latvia       +961     Lebanon       +266     Lesotho       +231     Liberia       +218     Libya       +423     Liechtenstein       +370     Lithuania       +352     Luxembourg       +853     Macau SAR China       +389     Macedonia       +261     Madagascar       +265     Malawi       +60     Malaysia       +960     Maldives       +223     Mali       +356     Malta       +692     Marshall Islands       +596     Martinique       +222     Mauritania       +230     Mauritius       +262     Mayotte       +52     Mexico       +691     Micronesia       +1 808     Midway Island       +373     Moldova       +377     Monaco       +976     Mongolia       +382     Montenegro       +1664     Montserrat       +212     Morocco       +95     Myanmar       +264     Namibia       +674     Nauru       +977     Nepal       +31     Netherlands       +599     Netherlands Antilles       +1 869     Nevis       +687     New Caledonia       +64     New Zealand       +505     Nicaragua       +227     Niger       +234     Nigeria       +683     Niue       +672     Norfolk Island       +850     North Korea       +1 670     Northern Mariana Islands       +47     Norway       +968     Oman       +92     Pakistan       +680     Palau       +970     Palestinian Territory       +507     Panama       +675     Papua New Guinea       +595     Paraguay       +51     Peru       +63     Philippines       +48     Poland       +351     Portugal       +1 787     Puerto Rico       +974     Qatar       +262     Reunion       +40     Romania       +7     Russia       +250     Rwanda       +685     Samoa       +378     San Marino       +966     Saudi Arabia       +221     Senegal       +381     Serbia       +248     Seychelles       +232     Sierra Leone       +65     Singapore       +421     Slovakia       +386     Slovenia       +677     Solomon Islands       +27     South Africa       +500     South Georgia and the South Sandwich Islands       +82     South Korea       +34     Spain       +94     Sri Lanka       +249     Sudan       +597     Suriname       +268     Swaziland       +46     Sweden       +41     Switzerland       +963     Syria       +886     Taiwan       +992     Tajikistan       +255     Tanzania       +66     Thailand       +670     Timor Leste       +228     Togo       +690     Tokelau       +676     Tonga       +1 868     Trinidad and Tobago       +216     Tunisia       +90     Turkey       +993     Turkmenistan       +1 649     Turks and Caicos Islands       +688     Tuvalu       +1 340     U.S. Virgin Islands       +256     Uganda       +380     Ukraine       +971     United Arab Emirates       +44     United Kingdom       +1     United States       +598     Uruguay       +998     Uzbekistan       +678     Vanuatu       +58     Venezuela       +84     Vietnam       +1 808     Wake Island       +681     Wallis and Futuna       +967     Yemen       +260     Zambia       +255     Zanzibar       +263     Zimbabwe 


回答7:

You can download as a CSV file here. http://www.aggdata.com/free/international-calling-codes



回答8:

Android ready county list and flag images

                    +93         Afghanistan         AF         @drawable/afghanistan                   +355         Albania         AL         @drawable/albania          ...               @array/data000         @array/data001         ...      


回答9:

Here is a JS function that converts "Country Code" (ISO3) to Telephone "Calling Code":

function country_iso3_to_country_calling_code(country_iso3) {         if(country_iso3 == 'AFG') return '93';         if(country_iso3 == 'ALB') return '355';         if(country_iso3 == 'DZA') return '213';         if(country_iso3 == 'ASM') return '1684';         if(country_iso3 == 'AND') return '376';         if(country_iso3 == 'AGO') return '244';         if(country_iso3 == 'AIA') return '1264';         if(country_iso3 == 'ATA') return '672';         if(country_iso3 == 'ATG') return '1268';         if(country_iso3 == 'ARG') return '54';         if(country_iso3 == 'ARM') return '374';         if(country_iso3 == 'ABW') return '297';         if(country_iso3 == 'AUS') return '61';         if(country_iso3 == 'AUT') return '43';         if(country_iso3 == 'AZE') return '994';         if(country_iso3 == 'BHS') return '1242';         if(country_iso3 == 'BHR') return '973';         if(country_iso3 == 'BGD') return '880';         if(country_iso3 == 'BRB') return '1246';         if(country_iso3 == 'BLR') return '375';         if(country_iso3 == 'BEL') return '32';         if(country_iso3 == 'BLZ') return '501';         if(country_iso3 == 'BEN') return '229';         if(country_iso3 == 'BMU') return '1441';         if(country_iso3 == 'BTN') return '975';         if(country_iso3 == 'BOL') return '591';         if(country_iso3 == 'BIH') return '387';         if(country_iso3 == 'BWA') return '267';         if(country_iso3 == 'BVT') return '_55';         if(country_iso3 == 'BRA') return '55';         if(country_iso3 == 'IOT') return '1284';         if(country_iso3 == 'BRN') return '673';         if(country_iso3 == 'BGR') return '359';         if(country_iso3 == 'BFA') return '226';         if(country_iso3 == 'BDI') return '257';         if(country_iso3 == 'KHM') return '855';         if(country_iso3 == 'CMR') return '237';         if(country_iso3 == 'CAN') return '1';         if(country_iso3 == 'CPV') return '238';         if(country_iso3 == 'CYM') return '1345';         if(country_iso3 == 'CAF') return '236';         if(country_iso3 == 'TCD') return '235';         if(country_iso3 == 'CHL') return '56';         if(country_iso3 == 'CHN') return '86';         if(country_iso3 == 'CXR') return '618';         if(country_iso3 == 'CCK') return '61';         if(country_iso3 == 'COL') return '57';         if(country_iso3 == 'COM') return '269';         if(country_iso3 == 'COG') return '242';         if(country_iso3 == 'COD') return '243';         if(country_iso3 == 'COK') return '682';         if(country_iso3 == 'CRI') return '506';         if(country_iso3 == 'HRV') return '385';         if(country_iso3 == 'CUB') return '53';         if(country_iso3 == 'CYP') return '357';         if(country_iso3 == 'CZE') return '420';         if(country_iso3 == 'DNK') return '45';         if(country_iso3 == 'DJI') return '253';         if(country_iso3 == 'DMA') return '1767';         if(country_iso3 == 'DOM') return '1';         if(country_iso3 == 'ECU') return '593';         if(country_iso3 == 'EGY') return '20';         if(country_iso3 == 'SLV') return '503';         if(country_iso3 == 'GNQ') return '240';         if(country_iso3 == 'ERI') return '291';         if(country_iso3 == 'EST') return '372';         if(country_iso3 == 'ETH') return        
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!