0

Try to create new collation using ICU extension for .NET:

var newCollation = Icu.Collation.Collator.Create("Cyrillic_General_CI_AS");

Following exception occures:

An unhandled exception of type 'System.ArgumentException' occurred in icu.net.dll Additional information: Unable to create a collator using the given localeId. This is likely because the ICU data file was created without collation rules for this locale. You can provide the rules yourself or replace the data dll.

decocijo
  • 908
  • 7
  • 19
Alderven
  • 7,569
  • 5
  • 26
  • 38

2 Answers2

1

There is no predefined collator for ru-RU-u-co-ks-level2. You can pass the FallBackAllowed parameter so that it falls back to ru.

Icu.Collation.Collator.Create("ru-RU-u-co-ks-level2", Collator.Fallback.FallbackAllowed)

Or do as the exception message says and define your own collation rules.

You can see the predefined collators by looking at the icu4c source tree.

decocijo
  • 908
  • 7
  • 19
0

The collation identifier you supply is the form that SQL Server uses but ICU uses a locale to identify the collation. Cyrillic General is used by Russian, Bulgarian and many other languages that use Cyrillic script. CI means case insensitive and AS means accent sensitive so I would use locale ru-RU-u-co-ks-level2 to get similar behavior.

Eric MSFT
  • 3,246
  • 1
  • 18
  • 28