Skip to content

Commit

Permalink
Using Intl extension to anglicisation (#22870)
Browse files Browse the repository at this point in the history
* Using Intl extension to anglicisation

This should fix bug #22321

* Update Php.php

* Update plugins/GeoIp2/LocationProvider/GeoIp2/Php.php

Co-authored-by: Michal Kleiner <[email protected]>

* Update plugins/GeoIp2/LocationProvider/GeoIp2/Php.php

Co-authored-by: Stefan Giehl <[email protected]>

---------

Co-authored-by: Michal Kleiner <[email protected]>
Co-authored-by: Stefan Giehl <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2025
1 parent ff9070a commit b64e4ca
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/GeoIp2/LocationProvider/GeoIp2/Php.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,11 @@ private function fuzzyMatch(string $str1, string $str2): bool
return true;
}

// try converting umlauts to closted ascii char if iconv is available
if (function_exists('iconv')) {
// try converting umlauts to the closest ascii char if intl or iconv is available
if (function_exists('transliterator_transliterate')) {
$str1 = transliterator_transliterate('Any-Latin; Latin-ASCII', $str1);
$str2 = transliterator_transliterate('Any-Latin; Latin-ASCII', $str2);
} elseif (function_exists('iconv')) {
$str1 = iconv('UTF-8', 'ASCII//TRANSLIT', $str1);
$str2 = iconv('UTF-8', 'ASCII//TRANSLIT', $str2);
}
Expand Down

0 comments on commit b64e4ca

Please sign in to comment.