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 4052f0e commit 769d61a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions IP2LocationBinary.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public function geocodeQuery(GeocodeQuery $query): Collection
Address::createFromArray([
'providedBy' => $this->getName(),
'countryCode' => $records['countryCode'],
'country' => null === $records['countryName'] ? null : utf8_encode($records['countryName']),
'country' => null === $records['countryName'] ? null : mb_convert_encoding($records['countryName'], 'UTF-8', 'ISO-8859-1'),
'adminLevels' => $adminLevels,
'locality' => null === $records['cityName'] ? null : utf8_encode($records['cityName']),
'locality' => null === $records['cityName'] ? null : mb_convert_encoding($records['cityName'], 'UTF-8', 'ISO-8859-1'),
'latitude' => $records['latitude'],
'longitude' => $records['longitude'],
'postalCode' => $records['zipCode'],
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",
"ip2location/ip2location-php": "^8.1.1",
"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 769d61a

Please sign in to comment.