stefanocudini / leaflet-search

Search stuff in a Leaflet map
https://opengeo.tech/maps/leaflet-search/
MIT License
780 stars 335 forks source link

Case sensitive with "non-english" character #292

Closed soli004 closed 2 years ago

soli004 commented 2 years ago

In my url for search there is a mix of all small letters and all with caps. For example I have: PLACE UPPHÄRAD When doing a search: place upph it shows the correct suggestion but when entering place upphä it disappear and shows "not found"

If you do a copy and paste from a document it will not work if the text copied is not all caps. Is there a way to solve this?

gg1971 commented 2 years ago

https://github.com/stefanocudini/leaflet-search/blob/master/examples/search.php

change add u modifier: unicode. Pattern strings are treated as UTF-16. Also causes escape sequences to match unicode characters

function searchInit($text) //search initial text in titles { $reg = "/^".$_GET['q']."/iu"; //initial case insensitive searching add u for unicode return (bool)@preg_match($reg, $text['title']); }

soli004 commented 2 years ago

Thanks that did solve the problem