Categories
discuss

Locale.UK and country code

According to the ISO 2 character codes uk = United Kingdom. But Locale.UK.getCountry() is returning GB. Am I missing something?

Answer

According to this,

The getCountry() method returns the ISO 3166 two-letter abbreviation for the locale’s region or country member.

The ISO 3166 two-letter abbreviation for the UK is indeed GB. uk is not part of the standard, but more of a historical accident:

The use of .uk rather than .gb for the top-level domain is due to its pre-existing use in the (now obsolete) JANET Name Registration Scheme in which the order of address components were reversed. .uk was made available in DNS to simplify the translation to and from these addresses. There were plans for eventual transition to .gb to accord with correct usage, but this never occurred; the use of .uk is now entrenched, and it is impossible to register a .gb domain.

Depending on your target use, you may need to replace .gb with .uk.

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..