Skip to content

Commit 769d61a

Browse files
authored
Utf8 encode (#1225)
* provider: IP2LocationBinary: replace utf8_encode with mb_convert_encoding * provider: MaxMindBinary: replace utf8_encode with mb_convert_encoding
1 parent 4052f0e commit 769d61a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

IP2LocationBinary.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ public function geocodeQuery(GeocodeQuery $query): Collection
8181
Address::createFromArray([
8282
'providedBy' => $this->getName(),
8383
'countryCode' => $records['countryCode'],
84-
'country' => null === $records['countryName'] ? null : utf8_encode($records['countryName']),
84+
'country' => null === $records['countryName'] ? null : mb_convert_encoding($records['countryName'], 'UTF-8', 'ISO-8859-1'),
8585
'adminLevels' => $adminLevels,
86-
'locality' => null === $records['cityName'] ? null : utf8_encode($records['cityName']),
86+
'locality' => null === $records['cityName'] ? null : mb_convert_encoding($records['cityName'], 'UTF-8', 'ISO-8859-1'),
8787
'latitude' => $records['latitude'],
8888
'longitude' => $records['longitude'],
8989
'postalCode' => $records['zipCode'],

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"require": {
1515
"php": "^8.0",
1616
"ip2location/ip2location-php": "^8.1.1",
17+
"symfony/polyfill-mbstring": "^1.0",
1718
"willdurand/geocoder": "^4.0"
1819
},
1920
"provide": {
@@ -42,4 +43,4 @@
4243
"test": "vendor/bin/phpunit",
4344
"test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
4445
}
45-
}
46+
}

0 commit comments

Comments
 (0)