0

In C#, I want to convert strings to upper case following the rules of Unicode-defined "full case mappings" with no culture-specific tailoring. This means, for example, that ß must convert to SS.

Both String.ToUpper() and String.ToUpperInvariant() convert ß to ß.

Is there a method (built in or third party) that implements this specification?

Someone closed this question claiming it is a duplicate of Convert a string to ordinal upper or lower case. I'm afraid they didn't read either question very carefully. That question makes no mention of Unicode standards for case folding. Also, the question has an answer, but it doesn't have a solution, and since 5 years have elapsed, I was hoping there might now be a solution.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
  • 3
    `ß must convert to SS` why? according to wiki - since 2017 eszett can be capitalized to `ẞ` (U+1E9E ẞ LATIN CAPITAL LETTER SHARP S) – Iłya Bursov Oct 10 '22 at 23:17
  • 1
    _"That question makes no mention of Unicode standards for case folding"_ - No, but it _does_ mention that .NET simply does not support case-folding, whether or not it follows the Unicode spec is immaterial. I verified that this is still the case in .NET 6 and 7 RC1. – Dai Oct 11 '22 at 00:14
  • @IłyaBursov because capital ẞ is very rarely used in German, and is usually written SS in preference. However, that's irrelevant. I want something that conforms to the Unicode standard, whether Unicode got it right or not. – Michael Kay Oct 11 '22 at 05:58
  • 1
    @Dai my general view is that a question should not be closed as a duplicate of another simply because both questions have the same answer. – Michael Kay Oct 11 '22 at 06:00
  • 2
    @MichaelKay I think we can respectfully agree-to-disagree on that? – Dai Oct 11 '22 at 06:13
  • If the answer, as here, is "it can't be done", then closing all questions having that answer as duplicates would be most unhelpful indeed. – Michael Kay Oct 17 '22 at 08:07

0 Answers0