A script to generate a formatted country list in the format you want with their country codes. You can adapt it easily to generate the list you need in the language you want.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Country List

During a client project using Paypal DirectPayment API, I had to make a <select> with all the countries with their country code as the value. For example:

<option value="US">United States</option>
<option value="CA">Canada</option>

Paypal already gives this list https://www.paypalobjects.com/en_US/ebook/PP_NVPAPI_DeveloperGuide/countrycodes_new.html.

Problem is that it's only in English and all in caps. What I needed is a French version and an English version, not in caps.

Geonames.org just happens to have what I needed. This script is what I coded to generate what I needed.

Hope it's useful to someone else.