This tool takes the canonical list of country codes in XML format and outputs it in the format of your choice.
The source contains ISO 3166-1 ISO 2 digit country codes and names, UN Recommendation 3.