Skip to content

Commit 906c7e3

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 68da202 commit 906c7e3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

MaxMindBinary.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ public function geocodeQuery(GeocodeQuery $query): Collection
9292
Address::createFromArray([
9393
'providedBy' => $this->getName(),
9494
'countryCode' => $geoIpRecord->country_code,
95-
'country' => null === $geoIpRecord->country_name ? null : utf8_encode($geoIpRecord->country_name),
95+
'country' => null === $geoIpRecord->country_name ? null : mb_convert_encoding($geoIpRecord->country_name, 'UTF-8', 'ISO-8859-1'),
9696
'adminLevels' => $adminLevels,
97-
'locality' => null === $geoIpRecord->city ? null : utf8_encode($geoIpRecord->city),
97+
'locality' => null === $geoIpRecord->city ? null : mb_convert_encoding($geoIpRecord->city, 'UTF-8', 'ISO-8859-1'),
9898
'latitude' => $geoIpRecord->latitude,
9999
'longitude' => $geoIpRecord->longitude,
100100
'postalCode' => $geoIpRecord->postal_code,

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"require": {
1515
"php": "^8.0",
1616
"geoip/geoip": "^1.17",
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)