line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# CountryCodes.pm - map country codes to country names.
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
## no critic (Documentation::RequirePodAtEnd)
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Weather::GHCN::CountryCodes - convert between various country codes
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
version v0.0.010 |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Weather::GHCN::CountryCodes qw(:all);
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
The B module provides functions to search a table of country
|
21
|
|
|
|
|
|
|
codes and country names using various search criteria. It can also do a
|
22
|
|
|
|
|
|
|
direct lookup of a country entry using the 2-character GEC (formerly FIPS)
|
23
|
|
|
|
|
|
|
code.
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
The source for the mapping table is taken from the CIA World Factbook. See
|
26
|
|
|
|
|
|
|
https://www.cia.gov/library/publications/the-world-factbook/appendix/appendix-d.html
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
The module is primarily for use by modules Weather::GHCN::Options, and
|
29
|
|
|
|
|
|
|
Weather::GHCN::StationTable.
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
## no critic [ValuesAndExpressions::ProhibitVersionStrings]
|
34
|
|
|
|
|
|
|
## no critic [TestingAndDebugging::RequireUseWarnings]
|
35
|
|
|
|
|
|
|
## no critic [ProhibitSubroutinePrototypes]
|
36
|
|
|
|
|
|
|
|
37
|
6
|
|
|
6
|
|
112985
|
use v5.18; # minimum for Object::Pad
|
|
6
|
|
|
|
|
29
|
|
38
|
|
|
|
|
|
|
|
39
|
6
|
|
|
6
|
|
35
|
use feature 'signatures';
|
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
619
|
|
40
|
6
|
|
|
6
|
|
42
|
no warnings 'experimental::signatures';
|
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
422
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
package Weather::GHCN::CountryCodes;
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
our $VERSION = 'v0.0.010'; |
46
|
|
|
|
|
|
|
|
47
|
6
|
|
|
6
|
|
39
|
use Carp qw(carp croak cluck confess);
|
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
442
|
|
48
|
6
|
|
|
6
|
|
2505
|
use English qw(-no_match_vars);
|
|
6
|
|
|
|
|
12458
|
|
|
6
|
|
|
|
|
44
|
|
49
|
6
|
|
|
6
|
|
2148
|
use Const::Fast;
|
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
47
|
|
50
|
|
|
|
|
|
|
|
51
|
6
|
|
|
6
|
|
371
|
use Exporter;
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
203
|
|
52
|
6
|
|
|
6
|
|
865
|
use parent 'Exporter';
|
|
6
|
|
|
|
|
626
|
|
|
6
|
|
|
|
|
75
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Items to export into callers namespace by default.
|
55
|
|
|
|
|
|
|
## no critic [Modules::ProhibitAutomaticExportation]
|
56
|
|
|
|
|
|
|
our @EXPORT = ( qw/ get_country_by_gec search_country / );
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my %Country;
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Preloaded methods go here.
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Constants
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
const my $EMPTY => q(); # empty string
|
66
|
|
|
|
|
|
|
const my $SPACE => q( ); # space character
|
67
|
|
|
|
|
|
|
const my $TAB => qq(\t); # tab character
|
68
|
|
|
|
|
|
|
const my $TRUE => 1; # perl's usual TRUE
|
69
|
|
|
|
|
|
|
const my $FALSE => not $TRUE; # a dual-var consisting of '' and 0
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
#############################################################################
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Load the %Country hash during the UNITCHECK phase, before any of the
|
75
|
|
|
|
|
|
|
# regular runtime code needs it.
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
UNITCHECK {
|
78
|
|
|
|
|
|
|
my @lines = split m{ \n }xms, country_table();
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
foreach my $line (@lines) {
|
81
|
|
|
|
|
|
|
my ($entity, $gec, $iso2, $iso3, $isonum, $nato, $internet, $comment) = split m{ [|] }xms, $line;
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# skip table entries with no GEC
|
84
|
|
|
|
|
|
|
next if $gec eq q(-);
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# check for duplicates, though there shouldn't be any
|
87
|
|
|
|
|
|
|
croak "*W* country $entity with GEC $gec already exists"
|
88
|
|
|
|
|
|
|
if $Country{$gec};
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
$Country{$gec} = {
|
91
|
|
|
|
|
|
|
'name' => $entity,
|
92
|
|
|
|
|
|
|
'gec' => $gec,
|
93
|
|
|
|
|
|
|
'iso2' => $iso2,
|
94
|
|
|
|
|
|
|
'iso3' => $iso3,
|
95
|
|
|
|
|
|
|
'isonum' => $isonum,
|
96
|
|
|
|
|
|
|
'nato' => $nato,
|
97
|
|
|
|
|
|
|
'internet' => $internet,
|
98
|
|
|
|
|
|
|
'comment' => $comment
|
99
|
|
|
|
|
|
|
};
|
100
|
|
|
|
|
|
|
}
|
101
|
|
|
|
|
|
|
}
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
#############################################################################
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 FUNCTIONS
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 get_country_by_gec($code)
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
For a given GEC (FIPS) country code, return a hash containing the country
|
110
|
|
|
|
|
|
|
name and other country codes. Returns empty if the code was not found.
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut
|
113
|
|
|
|
|
|
|
|
114
|
4
|
|
|
4
|
1
|
14284
|
sub get_country_by_gec ($code) {
|
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
6
|
|
115
|
|
|
|
|
|
|
# uncoverable condition right
|
116
|
4
|
|
66
|
|
|
23
|
return $Country{$code} // $EMPTY;
|
117
|
|
|
|
|
|
|
}
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 search_country( $search [, $type] )
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Search the country table and return the entries which match the
|
122
|
|
|
|
|
|
|
search criteria. The optional $type argument allows you to designate
|
123
|
|
|
|
|
|
|
which field the search criteria is to be matched against, as follows:
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
name does an unanchored pattern match on the country name
|
126
|
|
|
|
|
|
|
gec matches the GEC (formerly FIPS) country code
|
127
|
|
|
|
|
|
|
iso2 matches the ISO 3166 2-character country code
|
128
|
|
|
|
|
|
|
iso3 matches the ISO 3166 3-character country code
|
129
|
|
|
|
|
|
|
isonum matches the ISO 3166 country numeric code
|
130
|
|
|
|
|
|
|
nato matches the STANAG 1059 country code used by NATO
|
131
|
|
|
|
|
|
|
internet matches the internet country code (such as .ca)
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
If the search criteria is only two-characters long, then the type
|
134
|
|
|
|
|
|
|
defaults to gec. To match a name, the search criteria must be longer
|
135
|
|
|
|
|
|
|
than three characters, otherwise you'll get results from matches against
|
136
|
|
|
|
|
|
|
gec or iso3.
|
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
In list context, all matches are returned. In scalar context,
|
139
|
|
|
|
|
|
|
only the first match is returned. Undef is returned if there
|
140
|
|
|
|
|
|
|
are no matches.
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut
|
143
|
|
|
|
|
|
|
|
144
|
22
|
|
|
22
|
1
|
16305
|
sub search_country ($search_value, $field) {
|
|
22
|
|
|
|
|
50
|
|
|
22
|
|
|
|
|
36
|
|
|
22
|
|
|
|
|
35
|
|
145
|
22
|
|
|
|
|
37
|
my $search_key;
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
## no critic [ValuesAndExpressions::ProhibitMagicNumbers]
|
148
|
|
|
|
|
|
|
## no critic [ControlStructures::ProhibitCascadingIfElse]
|
149
|
|
|
|
|
|
|
|
150
|
22
|
100
|
|
|
|
61
|
if ( defined $field ) {
|
151
|
8
|
100
|
|
|
|
55
|
if ( $field !~ m{ \A (?: gec | iso2 | iso3 | isonum | nato | internet | name) \Z }xmsi) {
|
152
|
1
|
|
|
|
|
19
|
croak 'invalid search field name';
|
153
|
|
|
|
|
|
|
}
|
154
|
7
|
|
|
|
|
18
|
$search_key = lc $field;
|
155
|
|
|
|
|
|
|
} else {
|
156
|
14
|
100
|
|
|
|
106
|
if ( $search_value =~ m{ \A \d+ \Z }xms ) {
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
157
|
1
|
|
|
|
|
4
|
$search_key = 'isonum';
|
158
|
|
|
|
|
|
|
}
|
159
|
|
|
|
|
|
|
elsif ( $search_value =~ m{ \A [.][[:lower:]][[:lower:]] \Z }xmsi ) {
|
160
|
1
|
|
|
|
|
3
|
$search_key = 'internet';
|
161
|
|
|
|
|
|
|
}
|
162
|
|
|
|
|
|
|
elsif ( length $search_value == 2 ) {
|
163
|
7
|
|
|
|
|
17
|
$search_key = 'gec';
|
164
|
|
|
|
|
|
|
}
|
165
|
|
|
|
|
|
|
elsif ( length $search_value == 3 ) {
|
166
|
2
|
|
|
|
|
4
|
$search_key = 'iso3';
|
167
|
|
|
|
|
|
|
}
|
168
|
|
|
|
|
|
|
# can't distinguish between iso3 and nato so this branch
|
169
|
|
|
|
|
|
|
# would be unreachable -- removed for better test coverage
|
170
|
|
|
|
|
|
|
# elsif ( length $search_value == 3 ) {
|
171
|
|
|
|
|
|
|
# $search_key = 'nato';
|
172
|
|
|
|
|
|
|
# }
|
173
|
|
|
|
|
|
|
else {
|
174
|
3
|
|
|
|
|
10
|
$search_key = 'name';
|
175
|
|
|
|
|
|
|
}
|
176
|
|
|
|
|
|
|
}
|
177
|
|
|
|
|
|
|
|
178
|
21
|
|
|
|
|
39
|
my @results;
|
179
|
21
|
|
|
|
|
631
|
foreach my $href (
|
180
|
39022
|
|
|
|
|
58555
|
sort { $a->{$search_key} cmp $b->{$search_key} }
|
181
|
|
|
|
|
|
|
values %Country )
|
182
|
|
|
|
|
|
|
{
|
183
|
5691
|
|
|
|
|
8554
|
my $v = lc $href->{$search_key};
|
184
|
|
|
|
|
|
|
|
185
|
5691
|
100
|
|
|
|
8638
|
if ($search_key eq 'name') {
|
186
|
|
|
|
|
|
|
## no critic [RequireDotMatchAnything]
|
187
|
|
|
|
|
|
|
## no critic [RequireExtendedFormatting]
|
188
|
|
|
|
|
|
|
## no critic [RequireLineBoundaryMatching]
|
189
|
1084
|
100
|
|
|
|
2279
|
push @results, $href if $v =~ m{$search_value}i;
|
190
|
|
|
|
|
|
|
} else {
|
191
|
4607
|
100
|
|
|
|
8695
|
push @results, $href if $v eq lc $search_value
|
192
|
|
|
|
|
|
|
}
|
193
|
|
|
|
|
|
|
}
|
194
|
|
|
|
|
|
|
|
195
|
21
|
|
|
|
|
128
|
return @results;
|
196
|
|
|
|
|
|
|
}
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head2 country_table
|
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Returns the country table.
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=cut
|
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub country_table {
|
205
|
6
|
|
|
6
|
1
|
22
|
my () = @_;
|
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
#entity|gec|iso2|iso3|isonum|nato|internet|comment
|
208
|
|
|
|
|
|
|
|
209
|
6
|
|
|
|
|
378
|
return <<'_TABLE_';
|
210
|
|
|
|
|
|
|
Afghanistan|AF|AF|AFG|4|AFG|.af|
|
211
|
|
|
|
|
|
|
Akrotiri|AX|-|-|-|-|-|
|
212
|
|
|
|
|
|
|
Albania|AL|AL|ALB|8|ALB|.al|
|
213
|
|
|
|
|
|
|
Algeria|AG|DZ|DZA|12|DZA|.dz|
|
214
|
|
|
|
|
|
|
American Samoa|AQ|AS|ASM|16|ASM|.as|
|
215
|
|
|
|
|
|
|
Andorra|AN|AD|AND|20|AND|.ad|
|
216
|
|
|
|
|
|
|
Angola|AO|AO|AGO|24|AGO|.ao|
|
217
|
|
|
|
|
|
|
Anguilla|AV|AI|AIA|660|AIA|.ai|
|
218
|
|
|
|
|
|
|
Antarctica|AY|AQ|ATA|10|ATA|.aq|ISO defines as the territory south of 60 degrees south latitude
|
219
|
|
|
|
|
|
|
Antigua and Barbuda|AC|AG|ATG|28|ATG|.ag|
|
220
|
|
|
|
|
|
|
Argentina|AR|AR|ARG|32|ARG|.ar|
|
221
|
|
|
|
|
|
|
Armenia|AM|AM|ARM|51|ARM|.am|
|
222
|
|
|
|
|
|
|
Aruba|AA|AW|ABW|533|ABW|.aw|
|
223
|
|
|
|
|
|
|
Ashmore and Cartier Islands|AT|-|-|-|AUS|-|ISO includes with Australia
|
224
|
|
|
|
|
|
|
Australia|AS|AU|AUS|36|AUS|.au|ISO includes Ashmore and Cartier Islands, Coral Sea Islands
|
225
|
|
|
|
|
|
|
Austria|AU|AT|AUT|40|AUT|.at|
|
226
|
|
|
|
|
|
|
Azerbaijan|AJ|AZ|AZE|31|AZE|.az|
|
227
|
|
|
|
|
|
|
Bahamas, The|BF|BS|BHS|44|BHS|.bs|
|
228
|
|
|
|
|
|
|
Bahrain|BA|BH|BHR|48|BHR|.bh|
|
229
|
|
|
|
|
|
|
Baker Island|FQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
|
230
|
|
|
|
|
|
|
Bangladesh|BG|BD|BGD|50|BGD|.bd|
|
231
|
|
|
|
|
|
|
Barbados|BB|BB|BRB|52|BRB|.bb|
|
232
|
|
|
|
|
|
|
Bassas da India|BS|-|-|-|-|-|administered as part of French Southern and Antarctic Lands; no ISO codes assigned
|
233
|
|
|
|
|
|
|
Belarus|BO|BY|BLR|112|BLR|.by|
|
234
|
|
|
|
|
|
|
Belgium|BE|BE|BEL|56|BEL|.be|
|
235
|
|
|
|
|
|
|
Belize|BH|BZ|BLZ|84|BLZ|.bz|
|
236
|
|
|
|
|
|
|
Benin|BN|BJ|BEN|204|BEN|.bj|
|
237
|
|
|
|
|
|
|
Bermuda|BD|BM|BMU|60|BMU|.bm|
|
238
|
|
|
|
|
|
|
Bhutan|BT|BT|BTN|64|BTN|.bt|
|
239
|
|
|
|
|
|
|
Bolivia|BL|BO|BOL|68|BOL|.bo|
|
240
|
|
|
|
|
|
|
Bosnia and Herzegovina|BK|BA|BIH|70|BIH|.ba|
|
241
|
|
|
|
|
|
|
Botswana|BC|BW|BWA|72|BWA|.bw|
|
242
|
|
|
|
|
|
|
Bouvet Island|BV|BV|BVT|74|BVT|.bv|
|
243
|
|
|
|
|
|
|
Brazil|BR|BR|BRA|76|BRA|.br|
|
244
|
|
|
|
|
|
|
British Indian Ocean Territory|IO|IO|IOT|86|IOT|.io|
|
245
|
|
|
|
|
|
|
British Virgin Islands|VI|VG|VGB|92|VGB|.vg|
|
246
|
|
|
|
|
|
|
Brunei|BX|BN|BRN|96|BRN|.bn|
|
247
|
|
|
|
|
|
|
Bulgaria|BU|BG|BGR|100|BGR|.bg|
|
248
|
|
|
|
|
|
|
Burkina Faso|UV|BF|BFA|854|BFA|.bf|
|
249
|
|
|
|
|
|
|
Burma|BM|MM|MMR|104|MMR|.mm|ISO uses the name Myanmar
|
250
|
|
|
|
|
|
|
Burundi|BY|BI|BDI|108|BDI|.bi|
|
251
|
|
|
|
|
|
|
Cabo Verde|CV|CV|CPV|132|CPV|.cv|
|
252
|
|
|
|
|
|
|
Cambodia|CB|KH|KHM|116|KHM|.kh|
|
253
|
|
|
|
|
|
|
Cameroon|CM|CM|CMR|120|CMR|.cm|
|
254
|
|
|
|
|
|
|
Canada|CA|CA|CAN|124|CAN|.ca|
|
255
|
|
|
|
|
|
|
Cayman Islands|CJ|KY|CYM|136|CYM|.ky|
|
256
|
|
|
|
|
|
|
Central African Republic|CT|CF|CAF|140|CAF|.cf|
|
257
|
|
|
|
|
|
|
Chad|CD|TD|TCD|148|TCD|.td|
|
258
|
|
|
|
|
|
|
Chile|CI|CL|CHL|152|CHL|.cl|
|
259
|
|
|
|
|
|
|
China|CH|CN|CHN|156|CHN|.cn|see also Taiwan
|
260
|
|
|
|
|
|
|
Christmas Island|KT|CX|CXR|162|CXR|.cx|
|
261
|
|
|
|
|
|
|
Clipperton Island|IP|-|-|-|FYP|-|ISO includes with France
|
262
|
|
|
|
|
|
|
Cocos (Keeling) Islands|CK|CC|CCK|166|AUS|.cc|
|
263
|
|
|
|
|
|
|
Colombia|CO|CO|COL|170|COL|.co|
|
264
|
|
|
|
|
|
|
Comoros|CN|KM|COM|174|COM|.km|
|
265
|
|
|
|
|
|
|
Congo, Democratic Republic of the|CG|CD|COD|180|COD|.cd|formerly Zaire
|
266
|
|
|
|
|
|
|
Congo, Republic of the|CF|CG|COG|178|COG|.cg|
|
267
|
|
|
|
|
|
|
Cook Islands|CW|CK|COK|184|COK|.ck|
|
268
|
|
|
|
|
|
|
Coral Sea Islands|CR|-|-|-|AUS|-|ISO includes with Australia
|
269
|
|
|
|
|
|
|
Costa Rica|CS|CR|CRI|188|CRI|.cr|
|
270
|
|
|
|
|
|
|
Cote d'Ivoire|IV|CI|CIV|384|CIV|.ci|
|
271
|
|
|
|
|
|
|
Croatia|HR|HR|HRV|191|HRV|.hr|
|
272
|
|
|
|
|
|
|
Cuba|CU|CU|CUB|192|CUB|.cu|
|
273
|
|
|
|
|
|
|
Curacao|UC|CW|CUW|531|-|.cw|
|
274
|
|
|
|
|
|
|
Cyprus|CY|CY|CYP|196|CYP|.cy|
|
275
|
|
|
|
|
|
|
Czechia|EZ|CZ|CZE|203|CZE|.cz|
|
276
|
|
|
|
|
|
|
Denmark|DA|DK|DNK|208|DNK|.dk|
|
277
|
|
|
|
|
|
|
Dhekelia|DX|-|-|-|-|-|
|
278
|
|
|
|
|
|
|
Djibouti|DJ|DJ|DJI|262|DJI|.dj|
|
279
|
|
|
|
|
|
|
Dominica|DO|DM|DMA|212|DMA|.dm|
|
280
|
|
|
|
|
|
|
Dominican Republic|DR|DO|DOM|214|DOM|.do|
|
281
|
|
|
|
|
|
|
Ecuador|EC|EC|ECU|218|ECU|.ec|
|
282
|
|
|
|
|
|
|
Egypt|EG|EG|EGY|818|EGY|.eg|
|
283
|
|
|
|
|
|
|
El Salvador|ES|SV|SLV|222|SLV|.sv|
|
284
|
|
|
|
|
|
|
Equatorial Guinea|EK|GQ|GNQ|226|GNQ|.gq|
|
285
|
|
|
|
|
|
|
Eritrea|ER|ER|ERI|232|ERI|.er|
|
286
|
|
|
|
|
|
|
Estonia|EN|EE|EST|233|EST|.ee|
|
287
|
|
|
|
|
|
|
Eswatini|WZ|SZ|SWZ|748|SWZ|.sz|
|
288
|
|
|
|
|
|
|
Ethiopia|ET|ET|ETH|231|ETH|.et|
|
289
|
|
|
|
|
|
|
Europa Island|EU|-|-|-|-|-|administered as part of French Southern and Antarctic Lands; no ISO codes assigned
|
290
|
|
|
|
|
|
|
Falkland Islands (Islas Malvinas)|FK|FK|FLK|238|FLK|.fk|
|
291
|
|
|
|
|
|
|
Faroe Islands|FO|FO|FRO|234|FRO|.fo|
|
292
|
|
|
|
|
|
|
Fiji|FJ|FJ|FJI|242|FJI|.fj|
|
293
|
|
|
|
|
|
|
Finland|FI|FI|FIN|246|FIN|.fi|
|
294
|
|
|
|
|
|
|
France|FR|FR|FRA|250|FRA|.fr|ISO includes metropolitan France along with the dependencies of Clipperton Island, French Guiana, French Polynesia, French Southern and Antarctic Lands, Guadeloupe, Martinique, Mayotte, New Caledonia, Reunion, Saint Pierre and Miquelon, Wallis and Futuna
|
295
|
|
|
|
|
|
|
France, Metropolitan|-|FX|FXX|249|-|.fx|ISO limits to the European part of France
|
296
|
|
|
|
|
|
|
French Guiana|FG|GF|GUF|254|GUF|.gf|
|
297
|
|
|
|
|
|
|
French Polynesia|FP|PF|PYF|258|PYF|.pf|
|
298
|
|
|
|
|
|
|
French Southern and Antarctic Lands|FS|TF|ATF|260|ATF|.tf|GEC does not include the French-claimed portion of Antarctica (Terre Adelie)
|
299
|
|
|
|
|
|
|
Gabon|GB|GA|GAB|266|GAB|.ga|
|
300
|
|
|
|
|
|
|
Gambia, The|GA|GM|GMB|270|GMB|.gm|
|
301
|
|
|
|
|
|
|
Gaza Strip|GZ|PS|PSE|275|PSE|.ps|ISO identifies as Occupied Palestinian Territory
|
302
|
|
|
|
|
|
|
Georgia|GG|GE|GEO|268|GEO|.ge|
|
303
|
|
|
|
|
|
|
Germany|GM|DE|DEU|276|DEU|.de|
|
304
|
|
|
|
|
|
|
Ghana|GH|GH|GHA|288|GHA|.gh|
|
305
|
|
|
|
|
|
|
Gibraltar|GI|GI|GIB|292|GIB|.gi|
|
306
|
|
|
|
|
|
|
Glorioso Islands|GO|-|-|-|-|-|administered as part of French Southern and Antarctic Lands; no ISO codes assigned
|
307
|
|
|
|
|
|
|
Greece|GR|GR|GRC|300|GRC|.gr|For its internal communications, the European Union recommends the use of the code EL in lieu of the ISO 3166-2 code of GR
|
308
|
|
|
|
|
|
|
Greenland|GL|GL|GRL|304|GRL|.gl|
|
309
|
|
|
|
|
|
|
Grenada|GJ|GD|GRD|308|GRD|.gd|
|
310
|
|
|
|
|
|
|
Guadeloupe|GP|GP|GLP|312|GLP|.gp|
|
311
|
|
|
|
|
|
|
Guam|GQ|GU|GUM|316|GUM|.gu|
|
312
|
|
|
|
|
|
|
Guatemala|GT|GT|GTM|320|GTM|.gt|
|
313
|
|
|
|
|
|
|
Guernsey|GK|GG|GGY|831|UK|.gg|
|
314
|
|
|
|
|
|
|
Guinea|GV|GN|GIN|324|GIN|.gn|
|
315
|
|
|
|
|
|
|
Guinea-Bissau|PU|GW|GNB|624|GNB|.gw|
|
316
|
|
|
|
|
|
|
Guyana|GY|GY|GUY|328|GUY|.gy|
|
317
|
|
|
|
|
|
|
Haiti|HA|HT|HTI|332|HTI|.ht|
|
318
|
|
|
|
|
|
|
Heard Island and McDonald Islands|HM|HM|HMD|334|HMD|.hm|
|
319
|
|
|
|
|
|
|
Holy See (Vatican City)|VT|VA|VAT|336|VAT|.va|
|
320
|
|
|
|
|
|
|
Honduras|HO|HN|HND|340|HND|.hn|
|
321
|
|
|
|
|
|
|
Hong Kong|HK|HK|HKG|344|HKG|.hk|
|
322
|
|
|
|
|
|
|
Howland Island|HQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
|
323
|
|
|
|
|
|
|
Hungary|HU|HU|HUN|348|HUN|.hu|
|
324
|
|
|
|
|
|
|
Iceland|IC|IS|ISL|352|ISL|.is|
|
325
|
|
|
|
|
|
|
India|IN|IN|IND|356|IND|.in|
|
326
|
|
|
|
|
|
|
Indonesia|ID|ID|IDN|360|IDN|.id|
|
327
|
|
|
|
|
|
|
Iran|IR|IR|IRN|364|IRN|.ir|
|
328
|
|
|
|
|
|
|
Iraq|IZ|IQ|IRQ|368|IRQ|.iq|
|
329
|
|
|
|
|
|
|
Ireland|EI|IE|IRL|372|IRL|.ie|
|
330
|
|
|
|
|
|
|
Isle of Man|IM|IM|IMN|833|UK|.im|
|
331
|
|
|
|
|
|
|
Israel|IS|IL|ISR|376|ISR|.il|
|
332
|
|
|
|
|
|
|
Italy|IT|IT|ITA|380|ITA|.it|
|
333
|
|
|
|
|
|
|
Jamaica|JM|JM|JAM|388|JAM|.jm|
|
334
|
|
|
|
|
|
|
Jan Mayen|JN|-|-|-|SJM|-|ISO includes with Svalbard
|
335
|
|
|
|
|
|
|
Japan|JA|JP|JPN|392|JPN|.jp|
|
336
|
|
|
|
|
|
|
Jarvis Island|DQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
|
337
|
|
|
|
|
|
|
Jersey|JE|JE|JEY|832|UK|.je|
|
338
|
|
|
|
|
|
|
Johnston Atoll|JQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
|
339
|
|
|
|
|
|
|
Jordan|JO|JO|JOR|400|JOR|.jo|
|
340
|
|
|
|
|
|
|
Juan de Nova Island|JU|-|-|-|-|-|administered as part of French Southern and Antarctic Lands; no ISO codes assigned
|
341
|
|
|
|
|
|
|
Kazakhstan|KZ|KZ|KAZ|398|KAZ|.kz|
|
342
|
|
|
|
|
|
|
Kenya|KE|KE|KEN|404|KEN|.ke|
|
343
|
|
|
|
|
|
|
Kingman Reef|KQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
|
344
|
|
|
|
|
|
|
Kiribati|KR|KI|KIR|296|KIR|.ki|
|
345
|
|
|
|
|
|
|
Korea, North|KN|KP|PRK|408|PRK|.kp|
|
346
|
|
|
|
|
|
|
Korea, South|KS|KR|KOR|410|KOR|.kr|
|
347
|
|
|
|
|
|
|
Kosovo|KV|XK|XKS|-|-|-|XK and XKS are ISO 3166 user assigned codes; ISO 3166 Maintenace Authority has not assigned codes
|
348
|
|
|
|
|
|
|
Kuwait|KU|KW|KWT|414|KWT|.kw|
|
349
|
|
|
|
|
|
|
Kyrgyzstan|KG|KG|KGZ|417|KGZ|.kg|
|
350
|
|
|
|
|
|
|
Laos|LA|LA|LAO|418|LAO|.la|
|
351
|
|
|
|
|
|
|
Latvia|LG|LV|LVA|428|LVA|.lv|
|
352
|
|
|
|
|
|
|
Lebanon|LE|LB|LBN|422|LBN|.lb|
|
353
|
|
|
|
|
|
|
Lesotho|LT|LS|LSO|426|LSO|.ls|
|
354
|
|
|
|
|
|
|
Liberia|LI|LR|LBR|430|LBR|.lr|
|
355
|
|
|
|
|
|
|
Libya|LY|LY|LBY|434|LBY|.ly|
|
356
|
|
|
|
|
|
|
Liechtenstein|LS|LI|LIE|438|LIE|.li|
|
357
|
|
|
|
|
|
|
Lithuania|LH|LT|LTU|440|LTU|.lt|
|
358
|
|
|
|
|
|
|
Luxembourg|LU|LU|LUX|442|LUX|.lu|
|
359
|
|
|
|
|
|
|
Macau|MC|MO|MAC|446|MAC|.mo|
|
360
|
|
|
|
|
|
|
Madagascar|MA|MG|MDG|450|MDG|.mg|
|
361
|
|
|
|
|
|
|
Malawi|MI|MW|MWI|454|MWI|.mw|
|
362
|
|
|
|
|
|
|
Malaysia|MY|MY|MYS|458|MYS|.my|
|
363
|
|
|
|
|
|
|
Maldives|MV|MV|MDV|462|MDV|.mv|
|
364
|
|
|
|
|
|
|
Mali|ML|ML|MLI|466|MLI|.ml|
|
365
|
|
|
|
|
|
|
Malta|MT|MT|MLT|470|MLT|.mt|
|
366
|
|
|
|
|
|
|
Marshall Islands|RM|MH|MHL|584|MHL|.mh|
|
367
|
|
|
|
|
|
|
Martinique|MB|MQ|MTQ|474|MTQ|.mq|
|
368
|
|
|
|
|
|
|
Mauritania|MR|MR|MRT|478|MRT|.mr|
|
369
|
|
|
|
|
|
|
Mauritius|MP|MU|MUS|480|MUS|.mu|
|
370
|
|
|
|
|
|
|
Mayotte|MF|YT|MYT|175|FRA|.yt|
|
371
|
|
|
|
|
|
|
Mexico|MX|MX|MEX|484|MEX|.mx|
|
372
|
|
|
|
|
|
|
Micronesia, Federated States of|FM|FM|FSM|583|FSM|.fm|
|
373
|
|
|
|
|
|
|
Midway Islands|MQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
|
374
|
|
|
|
|
|
|
Moldova|MD|MD|MDA|498|MDA|.md|
|
375
|
|
|
|
|
|
|
Monaco|MN|MC|MCO|492|MCO|.mc|
|
376
|
|
|
|
|
|
|
Mongolia|MG|MN|MNG|496|MNG|.mn|
|
377
|
|
|
|
|
|
|
Montenegro|MJ|ME|MNE|499|MNE|.me|
|
378
|
|
|
|
|
|
|
Montserrat|MH|MS|MSR|500|MSR|.ms|
|
379
|
|
|
|
|
|
|
Morocco|MO|MA|MAR|504|MAR|.ma|
|
380
|
|
|
|
|
|
|
Mozambique|MZ|MZ|MOZ|508|MOZ|.mz|
|
381
|
|
|
|
|
|
|
Myanmar|-|-|-|-|-|-|see Burma
|
382
|
|
|
|
|
|
|
Namibia|WA|NA|NAM|516|NAM|.na|
|
383
|
|
|
|
|
|
|
Nauru|NR|NR|NRU|520|NRU|.nr|
|
384
|
|
|
|
|
|
|
Navassa Island|BQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
|
385
|
|
|
|
|
|
|
Nepal|NP|NP|NPL|524|NPL|.np|
|
386
|
|
|
|
|
|
|
Netherlands|NL|NL|NLD|528|NLD|.nl|
|
387
|
|
|
|
|
|
|
Netherlands Antilles|NT||||ANT|.an|disestablished in October 2010 this entity no longer exists; ISO deleted the codes in December 2010
|
388
|
|
|
|
|
|
|
New Caledonia|NC|NC|NCL|540|NCL|.nc|
|
389
|
|
|
|
|
|
|
New Zealand|NZ|NZ|NZL|554|NZL|.nz|
|
390
|
|
|
|
|
|
|
Nicaragua|NU|NI|NIC|558|NIC|.ni|
|
391
|
|
|
|
|
|
|
Niger|NG|NE|NER|562|NER|.ne|
|
392
|
|
|
|
|
|
|
Nigeria|NI|NG|NGA|566|NGA|.ng|
|
393
|
|
|
|
|
|
|
Niue|NE|NU|NIU|570|NIU|.nu|
|
394
|
|
|
|
|
|
|
Norfolk Island|NF|NF|NFK|574|NFK|.nf|
|
395
|
|
|
|
|
|
|
North Macedonia|MK|MK|MKD|807|FYR|.mk|
|
396
|
|
|
|
|
|
|
Northern Mariana Islands|CQ|MP|MNP|580|MNP|.mp|
|
397
|
|
|
|
|
|
|
Norway|NO|NO|NOR|578|NOR|.no|
|
398
|
|
|
|
|
|
|
Oman|MU|OM|OMN|512|OMN|.om|
|
399
|
|
|
|
|
|
|
Pakistan|PK|PK|PAK|586|PAK|.pk|
|
400
|
|
|
|
|
|
|
Palau|PS|PW|PLW|585|PLW|.pw|
|
401
|
|
|
|
|
|
|
Palmyra Atoll|LQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
|
402
|
|
|
|
|
|
|
Panama|PM|PA|PAN|591|PAN|.pa|
|
403
|
|
|
|
|
|
|
Papua New Guinea|PP|PG|PNG|598|PNG|.pg|
|
404
|
|
|
|
|
|
|
Paracel Islands|PF|-|-|-|-|-|
|
405
|
|
|
|
|
|
|
Paraguay|PA|PY|PRY|600|PRY|.py|
|
406
|
|
|
|
|
|
|
Peru|PE|PE|PER|604|PER|.pe|
|
407
|
|
|
|
|
|
|
Philippines|RP|PH|PHL|608|PHL|.ph|
|
408
|
|
|
|
|
|
|
Pitcairn Islands|PC|PN|PCN|612|PCN|.pn|
|
409
|
|
|
|
|
|
|
Poland|PL|PL|POL|616|POL|.pl|
|
410
|
|
|
|
|
|
|
Portugal|PO|PT|PRT|620|PRT|.pt|
|
411
|
|
|
|
|
|
|
Puerto Rico|RQ|PR|PRI|630|PRI|.pr|
|
412
|
|
|
|
|
|
|
Qatar|QA|QA|QAT|634|QAT|.qa|
|
413
|
|
|
|
|
|
|
Reunion|RE|RE|REU|638|REU|.re|
|
414
|
|
|
|
|
|
|
Romania|RO|RO|ROU|642|ROU|.ro|
|
415
|
|
|
|
|
|
|
Russia|RS|RU|RUS|643|RUS|.ru|
|
416
|
|
|
|
|
|
|
Rwanda|RW|RW|RWA|646|RWA|.rw|
|
417
|
|
|
|
|
|
|
Saint Barthelemy|TB|BL|BLM|652|-|.bl|ccTLD .fr and .gp may also be used
|
418
|
|
|
|
|
|
|
Saint Helena, Ascension, and Tristan da Cunha|SH|SH|SHN|654|SHN|.sh|includes Saint Helena Island, Ascension Island, and the Tristan da Cunha archipelago
|
419
|
|
|
|
|
|
|
Saint Kitts and Nevis|SC|KN|KNA|659|KNA|.kn|
|
420
|
|
|
|
|
|
|
Saint Lucia|ST|LC|LCA|662|LCA|.lc|
|
421
|
|
|
|
|
|
|
Saint Martin|RN|MF|MAF|663|-|.mf|ccTLD .fr and .gp may also be used
|
422
|
|
|
|
|
|
|
Saint Pierre and Miquelon|SB|PM|SPM|666|SPM|.pm|
|
423
|
|
|
|
|
|
|
Saint Vincent and the Grenadines|VC|VC|VCT|670|VCT|.vc|
|
424
|
|
|
|
|
|
|
Samoa|WS|WS|WSM|882|WSM|.ws|
|
425
|
|
|
|
|
|
|
San Marino|SM|SM|SMR|674|SMR|.sm|
|
426
|
|
|
|
|
|
|
Sao Tome and Principe|TP|ST|STP|678|STP|.st|
|
427
|
|
|
|
|
|
|
Saudi Arabia|SA|SA|SAU|682|SAU|.sa|
|
428
|
|
|
|
|
|
|
Senegal|SG|SN|SEN|686|SEN|.sn|
|
429
|
|
|
|
|
|
|
Serbia|RI|RS|SRB|688|-|.rs|
|
430
|
|
|
|
|
|
|
Seychelles|SE|SC|SYC|690|SYC|.sc|
|
431
|
|
|
|
|
|
|
Sierra Leone|SL|SL|SLE|694|SLE|.sl|
|
432
|
|
|
|
|
|
|
Singapore|SN|SG|SGP|702|SGP|.sg|
|
433
|
|
|
|
|
|
|
Sint Maarten|NN|SX|SXM|534|-|.sx|
|
434
|
|
|
|
|
|
|
Slovakia|LO|SK|SVK|703|SVK|.sk|
|
435
|
|
|
|
|
|
|
Slovenia|SI|SI|SVN|705|SVN|.si|
|
436
|
|
|
|
|
|
|
Solomon Islands|BP|SB|SLB|90|SLB|.sb|
|
437
|
|
|
|
|
|
|
Somalia|SO|SO|SOM|706|SOM|.so|
|
438
|
|
|
|
|
|
|
South Africa|SF|ZA|ZAF|710|ZAF|.za|
|
439
|
|
|
|
|
|
|
South Georgia and the Islands|SX|GS|SGS|239|SGS|.gs|
|
440
|
|
|
|
|
|
|
South Sudan|OD|SS|SSD|728|-|-|IANA has designated .ss as the ccTLD for South Sudan, however it has not been activated in DNS root zone
|
441
|
|
|
|
|
|
|
Spain|SP|ES|ESP|724|ESP|.es|
|
442
|
|
|
|
|
|
|
Spratly Islands|PG|-|-|-|-|-|
|
443
|
|
|
|
|
|
|
Sri Lanka|CE|LK|LKA|144|LKA|.lk|
|
444
|
|
|
|
|
|
|
Sudan|SU|SD|SDN|729|SDN|.sd|
|
445
|
|
|
|
|
|
|
Suriname|NS|SR|SUR|740|SUR|.sr|
|
446
|
|
|
|
|
|
|
Svalbard|SV|SJ|SJM|744|SJM|.sj|ISO includes Jan Mayen
|
447
|
|
|
|
|
|
|
Sweden|SW|SE|SWE|752|SWE|.se|
|
448
|
|
|
|
|
|
|
Switzerland|SZ|CH|CHE|756|CHE|.ch|
|
449
|
|
|
|
|
|
|
Syria|SY|SY|SYR|760|SYR|.sy|
|
450
|
|
|
|
|
|
|
Taiwan|TW|TW|TWN|158|TWN|.tw|
|
451
|
|
|
|
|
|
|
Tajikistan|TI|TJ|TJK|762|TJK|.tj|
|
452
|
|
|
|
|
|
|
Tanzania|TZ|TZ|TZA|834|TZA|.tz|
|
453
|
|
|
|
|
|
|
Thailand|TH|TH|THA|764|THA|.th|
|
454
|
|
|
|
|
|
|
Timor-Leste|TT|TL|TLS|626|TLS|.tl|
|
455
|
|
|
|
|
|
|
Togo|TO|TG|TGO|768|TGO|.tg|
|
456
|
|
|
|
|
|
|
Tokelau|TL|TK|TKL|772|TKL|.tk|
|
457
|
|
|
|
|
|
|
Tonga|TN|TO|TON|776|TON|.to|
|
458
|
|
|
|
|
|
|
Trinidad and Tobago|TD|TT|TTO|780|TTO|.tt|
|
459
|
|
|
|
|
|
|
Tromelin Island|TE|-|-|-|-|-|administered as part of French Southern and Antarctic Lands; no ISO codes assigned
|
460
|
|
|
|
|
|
|
Tunisia|TS|TN|TUN|788|TUN|.tn|
|
461
|
|
|
|
|
|
|
Turkey|TU|TR|TUR|792|TUR|.tr|
|
462
|
|
|
|
|
|
|
Turkmenistan|TX|TM|TKM|795|TKM|.tm|
|
463
|
|
|
|
|
|
|
Turks and Caicos Islands|TK|TC|TCA|796|TCA|.tc|
|
464
|
|
|
|
|
|
|
Tuvalu|TV|TV|TUV|798|TUV|.tv|
|
465
|
|
|
|
|
|
|
Uganda|UG|UG|UGA|800|UGA|.ug|
|
466
|
|
|
|
|
|
|
Ukraine|UP|UA|UKR|804|UKR|.ua|
|
467
|
|
|
|
|
|
|
United Arab Emirates|AE|AE|ARE|784|ARE|.ae|
|
468
|
|
|
|
|
|
|
United Kingdom|UK|GB|GBR|826|GBR|.uk|for its internal communications, the European Union recommends the use of the code UK in lieu of the ISO 3166-2 code of GB
|
469
|
|
|
|
|
|
|
United States|US|US|USA|840|USA|.us|
|
470
|
|
|
|
|
|
|
United States Minor Outlying Islands|-|UM|UMI|581|-|.um|ISO includes Baker Island, Howland Island, Jarvis Island, Johnston Atoll, Kingman Reef, Midway Islands, Navassa Island, Palmyra Atoll, Wake Island
|
471
|
|
|
|
|
|
|
Uruguay|UY|UY|URY|858|URY|.uy|
|
472
|
|
|
|
|
|
|
Uzbekistan|UZ|UZ|UZB|860|UZB|.uz|
|
473
|
|
|
|
|
|
|
Vanuatu|NH|VU|VUT|548|VUT|.vu|
|
474
|
|
|
|
|
|
|
Venezuela|VE|VE|VEN|862|VEN|.ve|
|
475
|
|
|
|
|
|
|
Vietnam|VM|VN|VNM|704|VNM|.vn|
|
476
|
|
|
|
|
|
|
Virgin Islands|VQ|VI|VIR|850|VIR|.vi|
|
477
|
|
|
|
|
|
|
Virgin Islands (UK)|-|-|-|-|-|.vg|see British Virgin Islands
|
478
|
|
|
|
|
|
|
Virgin Islands (US)|-|-|-|-|-|.vi|see Virgin Islands
|
479
|
|
|
|
|
|
|
Wake Island|WQ|-|-|-|UMI|-|ISO includes with the US Minor Outlying Islands
|
480
|
|
|
|
|
|
|
Wallis and Futuna|WF|WF|WLF|876|WLF|.wf|
|
481
|
|
|
|
|
|
|
West Bank|WE|PS|PSE|275|PSE|.ps|ISO identifies as Occupied Palestinian Territory
|
482
|
|
|
|
|
|
|
Western Sahara|WI|EH|ESH|732|ESH|.eh|
|
483
|
|
|
|
|
|
|
Western Samoa|-|-|-|-|-|.ws|see Samoa
|
484
|
|
|
|
|
|
|
World|-|-|-|-|-|-|the Factbook uses the W data code from DIAM 65-18 Geopolitical Data Elements and Related Features, Data Standard No. 3, December 1994, published by the Defense Intelligence Agency
|
485
|
|
|
|
|
|
|
Yemen|YM|YE|YEM|887|YEM|.ye|
|
486
|
|
|
|
|
|
|
Zaire|-|-|-|-|-|-|see Democratic Republic of the Congo
|
487
|
|
|
|
|
|
|
Zambia|ZA|ZM|ZMB|894|ZMB|.zm|
|
488
|
|
|
|
|
|
|
Zimbabwe|ZI|ZW|ZWE|716|ZWE|.zw|
|
489
|
|
|
|
|
|
|
_TABLE_
|
490
|
|
|
|
|
|
|
}
|
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
1; # file must return true when compiled
|
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
__END__
|