Recently, the support team reported a problem where our clients from Turkey not seeing any items on a particular page. The support team had logged in as those clients and confirmed that they could see those items on that page. This problem then got escalated to the technical team. After trying out different ways to reproduce the bug, we eventually found that this is caused by the browser culture being set to Turkish.
The code that retrieves this list of items calls a legacy service that gets items with status of ‘Active’ as below
items.Where(x => x.Status.ToUpper() == "ACTIVE");
This works fine but breaks when your culture is Turkish. The lowercase ‘i’ when converting to uppercase in Turkish will become dotted I (notice the dot on top).
So the condition won’t meet and hence no items got returned.
It is very simple to fix this issue, you could either use ToUpperInvariant() which is culture insensitive
items.Where(x => x.Status.ToUpperInvariant() == "ACTIVE");
or use the Equals() with StringComparison.OrdinalIgnoreCase. This is my preferred way as you don’t need to convert the string to uppercase.
items.Where(x => x.Status.Equals("ACTIVE", StringComparison.OrdinalIgnoreCase));