Comparing User countries with Event countries

  • Comparing User countries with Event countries


    My research application is comparing User countries (User.getInfo) and Event countries (Event.getInfo). Can you tell me where I can get a list to match these correctly up?

    More specifically:
    <event ..>
    <venue ..>
    <country>United Kingdom</country>



    My current solution (simplified) in Java is:
    Locale[] availableLocales = Locale.getAvailableLocales();
    for (Locale l : availableLocales) {
    l.getCountry(); // gives back the 2 letter code
    l.getDisplayCountry(); // gives back the long country name

    The problem here is that it doesn't work for ALL countries, e.g. United Kingdom has the 2 letter code "GB" (Java) instead of "UK" ( API).

    Wikipedia lists the ISO 3166-1 alpha-2 codes (that also use GB for United Kingdom by the way) here:



    • JRoar sa...
    • Alumni
    • 13 apr 2012, 09:21
    I believe you'll only run into this problem with UK, so for all other cases your idea should work fine. I agree, though, that there should really be a machine readable form of the event's country in the response.

    Also be sure to call getDisplayCountry(Locale.ENGLISH)

Anonyma användare kan inte skriva inlägg. Vänligen logga in eller skapa ett konto för att göra inlägg i forumen.