"strasse".Equals("STRAße",StringComparison.InvariantCultureIgnoreCase)
This returns true. Which is correct. Unfortunately, when I store one of these in postgres, it thinks they are not the same when doing a case insensitive match (for example, with ~*
). I've also tested with citext.
So one solution would be to pre-fold the case, thus storing strasse
for either of these values, in another column. I could then index and search on that for matches.
I've been looking for how to fold case in C# for a while, and haven't been able to find a solution in C#. Obviously that knowledge is there because it can compare these strings properly, I just can't find where to get it from.
One solution would be to spawn a perl process perl -E "binmode STDOUT, ':utf8'; binmode STDIN, ':utf8'; while (<>) { print fc }"
, set the C# side of the process to utf8 for those pipes as well, and just send the text through perl to fold the case. But there has to be a better way than that.
string.Equals(str1,str2,StringComparison.CurrentCulture)
? – Icing