Skip to content

Commit

Permalink
Utf8 encode (#1225)
Browse files Browse the repository at this point in the history
* provider: IP2LocationBinary: replace utf8_encode with mb_convert_encoding

* provider: MaxMindBinary: replace utf8_encode with mb_convert_encoding
  • Loading branch information
kornrunner committed May 18, 2024
1 parent 68da202 commit 906c7e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions MaxMindBinary.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ public function geocodeQuery(GeocodeQuery $query): Collection
Address::createFromArray([
'providedBy' => $this->getName(),
'countryCode' => $geoIpRecord->country_code,
'country' => null === $geoIpRecord->country_name ? null : utf8_encode($geoIpRecord->country_name),
'country' => null === $geoIpRecord->country_name ? null : mb_convert_encoding($geoIpRecord->country_name, 'UTF-8', 'ISO-8859-1'),
'adminLevels' => $adminLevels,
'locality' => null === $geoIpRecord->city ? null : utf8_encode($geoIpRecord->city),
'locality' => null === $geoIpRecord->city ? null : mb_convert_encoding($geoIpRecord->city, 'UTF-8', 'ISO-8859-1'),
'latitude' => $geoIpRecord->latitude,
'longitude' => $geoIpRecord->longitude,
'postalCode' => $geoIpRecord->postal_code,
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"require": {
"php": "^8.0",
"geoip/geoip": "^1.17",
"symfony/polyfill-mbstring": "^1.0",
"willdurand/geocoder": "^4.0"
},
"provide": {
Expand Down Expand Up @@ -42,4 +43,4 @@
"test": "vendor/bin/phpunit",
"test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
}
}
}

0 comments on commit 906c7e3

Please sign in to comment.