Details

      Description

      I've been hunting a weird bug for a long time. I finally found it's cause.
      I'm Danish, thus my .NET culture is "da-DK". In this culture "Gaard", doesn't start with "Ga" because it thinks that "aa" is "å" (in Danish it was before 1948).
      That gives some unexpected results when doing prefix queries.

      The solution is to add StringComparison.InvariantCulture in all StartsWith comparisons.

      To verify my claim, try running:

      Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("da-DK");
      Assert.IsFalse("Gaard".StartsWith("Ga"));
      Assert.IsTrue("Gaard".StartsWith("Ga", StringComparison.InvariantCulture));

      Cheers,
      Niels Kühnel

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Niels Kühnel
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 4h
              4h
              Remaining:
              Remaining Estimate - 4h
              4h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development