Repository navigation
Description
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.3.85-1
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1697544511147309
Action Performed:
- Open the app
- Open settings->profile->personal details->address->country
- Search with letter 'Å' and observe that even though we have country with that letter in list, app still doesn't show that on n top of search eg: 'Åland Islands'
- Similarily search with letter 'é', we have multiple countries with that letter but search doesn't show them on top eg: 'São Tomé & Príncipe', 'Saint Barthélemy'
Expected Result:
App should consider latin or spanish letter in country search and display their results on top as we generally do on user search page and send message page
Actual Result:
App does not consider latin or spanish letter in country search and does not display their results on top
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- Android: Native
- Android: mWeb Chrome
- iOS: Native
- iOS: mWeb Safari
- MacOS: Chrome / Safari
- MacOS: Desktop
Screenshots/Videos
Android: Native
Android.native.country.search.not.specific.variation.letters.mp4
Android: mWeb Chrome
Android.chrome.search.not.change.by.variation.letters.mp4
iOS: Native
ios.native.country.search.not.specific.variation.letters.mov
iOS: mWeb Safari
ios.safari.country.search.not.specific.variation.letters.mov
MacOS: Chrome / Safari
mac.chrome.country.search.not.specific.variation.letters.mov
MacOS: Desktop
mac.desktop.country.search.not.specific.variation.letters.mov
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~01c62c8f44bacecbe2
- Upwork Job ID: 1714381091711156224
- Last Price Increase: 2023-10-31
- Automatic offers:
- situchan | Reviewer | 27762279
- graylewis | Contributor | 27762281
- dhanashree-sawant | Reporter | 27762282
Activity
[-]Country search does not consider Latin or Spanish letters in search[/-][+][$500] Country search does not consider Latin or Spanish letters in search[/+]melvin-bot commentedon Oct 17, 2023
Job added to Upwork: https://www.upwork.com/jobs/~01c62c8f44bacecbe2
melvin-bot commentedon Oct 17, 2023
Triggered auto assignment to @strepanier03 (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Oct 17, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Oct 17, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (
External)graylewis commentedon Oct 17, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
The country search page doesn't prioritize search results that contain the same diacritical marks as the search term over normalized matches
What is the root of the issue
Items in the array of countries being searched get sanitized with the StringUtils.sanitizeString() function which:
Removes diacritical marks and non-alphabetic and non-latin characters from a string.By running this on the array of countries to be searched and the search term, both searches with diacritical marks and searches without are treated the same. This is almost ideal behavior, but prioritizing exact matches with diacritical marks would be even better.
What changes do you think we should make in order to solve the problem?
In the searchCountryOptions file, where the results are generated by matching the search term against items of the countriesData array, we can add a sorting mechanism to prioritize exact matches including diacritical marks. In addition to this, we'll have to maintain the diacritical marks for the array of countries to be searched and then normalize the values as needed, rather than normalizing them all at once up front.
In code (this code is obviously sloppy, it's just for illustration purposes):
Updated logic to reflect updated requirements:
The conditional sort based on the presence of diacritics ensures we only run two sorts regardless of the search term.
As a side note, the call to the searchCountryOptions function should be memoized, as it currently runs every frame unnecessarily. This will more than offset any potential performance costs of running an additional sort on the search results array.
My solution in action:

What alternative solutions did you explore? (Optional)
NA
Victor-Nyagudi commentedon Oct 18, 2023
It seems this method removes letters with diacritics i.e. accented letters like é, so that could be affecting country search results.
App/src/libs/StringUtils.ts
Lines 4 to 11 in 1c051fe
I'm not sure if this is the intended behavior or a regression, so I asked about it in the pull request that introduced this method.
strepanier03 commentedon Oct 20, 2023
@situchan - Friendly bump on the proposal above.
82 remaining items
[-][$500] Country search does not consider Latin or Spanish letters in search[/-][+][HOLD for payment 2024-02-26] [$500] Country search does not consider Latin or Spanish letters in search[/+]melvin-bot commentedon Feb 19, 2024
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Feb 19, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.42-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-02-26. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Feb 19, 2024
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
strepanier03 commentedon Feb 26, 2024
@graylewis and @dhanashree-sawant - I've paid you both via Upwork and closed the contracts.
@situchan - I'll check in later today to see if the checklist is done and if so move forward then. If not, I'll check tomorrow morning.
situchan commentedon Feb 26, 2024
This is not really bug but improvement. We added enough automated tests so no need regression test.
strepanier03 commentedon Feb 26, 2024
Got it thanks for the context @situchan - I'll handle now.
strepanier03 commentedon Feb 26, 2024
Okay, payment sent and contract closed.
Thanks again everyone 👏
[-][HOLD for payment 2024-02-26] [$500] Country search does not consider Latin or Spanish letters in search[/-][+][PAID] [$500] Country search does not consider Latin or Spanish letters in search[/+]