alcohol / iso3166

A PHP library providing ISO 3166-1 data.
https://iso3166.thephpleague.com
MIT License
640 stars 59 forks source link

Please add support for Kosovo (XK) #45

Closed willemstuursma closed 6 years ago

willemstuursma commented 6 years ago

From Wikipedia:

The code XK is being used by the European Commission, the IMF, and SWIFT, CLDR and other organizations as a temporary country code for Kosovo.

alcohol commented 6 years ago

While this would be an accurate and welcome addition, I am not sure how to deal with the fact that there is no temporary alpha3 code nor a temporary numerical code, making the dataset rather incomplete.

willemstuursma commented 6 years ago

Yes it's a bit tricky.

How about this approach: the reality seems to be that there is a valid alpha2 code and not a valid alpha3 or numerical code, so the library should reflect that.

willemstuursma commented 6 years ago

It seems that the Kosovo passport uses RKS as the alpha-3 code.

mvdpanne commented 6 years ago

Hmm, I would argue that is probably best to keep it out of the library, as it is not officially part of the ISO 3166-1 standard. At this point in time, theoretically everyone can implement it as they wish. In practice, I have seen it being assigned the same numeric code as Serbia.

Interesting comment about it here: https://github.com/mledoze/countries/issues/126#issuecomment-76139418

In my opinion, the safest bet is to leave it to the users of this library to interpret XK the way they need to. It is a so-called user-assigned code element (see https://en.wikipedia.org/wiki/ISO_3166-1#Reserved_and_user-assigned_code_elements). So, if Kosovo is at some point officially added to the standard, it will probably not keep using that alpha-2 code.

alcohol commented 6 years ago

Also, in practical terms, you could simply decorate or wrap my class and override the relevant methods where you want to return additional, new and/or different data when given specific input value(s).

For now, I will not be adding it until it becomes fully official.

davidjeddy commented 5 years ago

As an option https://geonames.wordpress.com/2010/03/08/xk-country-code-for-kosovo/ states “If users need code elements to represent country names not included in this part of ISO 3166, the series of letters AA, QM to QZ, XA to XZ, and ZZ, and the series AAA to AAZ, QMA to QZZ, XAA to XZZ, and ZZA to ZZZ respectively and the series of numbers 900 to 999 are available.”

This may give us a valid way to add the codes, then update them when the codes are officially added.