From 906c7e3b8bfe0e3360863d3fb3bcac2b74d42e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Mom=C4=8Dilovi=C4=87?= Date: Sat, 18 May 2024 22:08:48 +0200 Subject: [PATCH] Utf8 encode (#1225) * provider: IP2LocationBinary: replace utf8_encode with mb_convert_encoding * provider: MaxMindBinary: replace utf8_encode with mb_convert_encoding --- MaxMindBinary.php | 4 ++-- composer.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/MaxMindBinary.php b/MaxMindBinary.php index 560ec74..3e1f8a8 100644 --- a/MaxMindBinary.php +++ b/MaxMindBinary.php @@ -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, diff --git a/composer.json b/composer.json index bf2b69d..e221758 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,7 @@ "require": { "php": "^8.0", "geoip/geoip": "^1.17", + "symfony/polyfill-mbstring": "^1.0", "willdurand/geocoder": "^4.0" }, "provide": { @@ -42,4 +43,4 @@ "test": "vendor/bin/phpunit", "test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml" } -} \ No newline at end of file +}