Skip to content

Update IP2LOCATION-ISO3166-2.CSV to the latest release - #40

Open
FSA-G wants to merge 1 commit into
ip2location:masterfrom
FSA-G:update-iso3166-2
Open

FSA-G wants to merge 1 commit into
ip2location:masterfrom
FSA-G:update-iso3166-2

Conversation

@FSA-G

@FSA-G FSA-G commented Nov 28, 2026

Copy link
Copy Markdown

data/IP2LOCATION-ISO3166-2.CSV hasn't changed since the Region class was added in 2022. This replaces it with the current release from https://www.ip2location.com/free/iso3166-2 (the zip is dated September 2026). The file is the published CSV unchanged, except that it has LF line endings like the existing file.

Among other updates, the new file has the four Indonesian provinces created in 2022, so Region::getRegionCode('ID', 'Papua Selatan') now returns ID-PS instead of null. Other countries change too, e.g. Kazakhstan, Uganda, Nepal and Ethiopia. All of these come from the published release.

A new test in tests/RegionTest.php checks the Indonesian codes. It fails with the old file and passes with the new one. The existing US-CA test still passes. The PHP deprecation PHPUnit reports (fgetcsv(): the $escape parameter must be provided, src/Region.php:74) is unrelated to this change and also happens on master.

Two things in the published file itself, in case you want to fix them in the release:

  • "ID","Papua Pengunungan","ID-PE" should be Papua Pegunungan.
  • Papua uses ID-PP and Maluku ID-ML. In ISO 3166-2:ID, those are the codes of the Papua and Maluku geographical units. The provinces are ID-PA and ID-MA.

I didn't change either here, so the file stays identical to your release.

The bundled file dates from 2022. Replace it with the current
IP2Location ISO 3166-2 subdivision code release (September 2026) from
https://www.ip2location.com/free/iso3166-2, unchanged except for line
endings (LF, like the existing file).

Among other updates this adds the four Indonesian provinces created in
2022 (ID-PD, ID-PE, ID-PS, ID-PT), so Region::getRegionCode() returns a
code for them. Add a test for that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant