View Full Version : Resolving country code to country name
linux2512
October 4th, 2006, 01:27 AM
I need to resolve a country code (US,GB,etc..) to the appropriate country name (United States, Great Britain, etc..), is there a country database I could access via C, C++? I've been sifting through header files and can't seem to find anything.
Thanks
asimon
October 4th, 2006, 05:22 AM
KDE's KLocale::twoAlphaToCountryName (http://developer.kde.org/documentation/library/3.5-api/kdelibs-apidocs/kdecore/html/classKLocale.html#a90) function does that. But if you don't do any KDE application, than kdelibs comes probably with too much overhead.
linux2512
October 4th, 2006, 01:38 PM
KDE's KLocale::twoAlphaToCountryName (http://developer.kde.org/documentation/library/3.5-api/kdelibs-apidocs/kdecore/html/classKLocale.html#a90) function does that. But if you don't do any KDE application, than kdelibs comes probably with too much overhead.
Thanks, I appreciate your reply, but my app is written in GTK.
toojays
October 5th, 2006, 04:19 AM
There is a package called iso-codes which contains a table of country code to name mappings. You can either parse the XML file /usr/share/xml/iso-codes/iso_3166.xml, or use the tab-delimited /usr/share/iso-codes/iso_3166.tab.
This package also provides gettext files to translate the country names from English into various other languages.
linux2512
October 5th, 2006, 10:46 AM
There is a package called iso-codes which contains a table of country code to name mappings. You can either parse the XML file /usr/share/xml/iso-codes/iso_3166.xml, or use the tab-delimited /usr/share/iso-codes/iso_3166.tab.
This package also provides gettext files to translate the country names from English into various other languages.
Just what I was looking for! Thanks toojays!
BalochDude
June 6th, 2008, 12:41 PM
I found this page with country codes, its a ms sql server script, but i am sure you can modify it to anything you want, it will give you a list of all the countries and their codes:
http://www.chapterzero.co.uk/articles/download-list-of-countries-codes.aspx
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.