0

There are two strings which have the same meaning in the Russian Language:

  1. "СРЕДСТВО ДЛЯ МЫТЫЯ СТЁКОЛ"
  2. "СРЕДСТВО ДЛЯ МЫТЫЯ СТЕКОЛ"

MS SQL

The first string is stored in the database. I can make where condition either with first string or second string but I am getting the record which is stored in the database.

.Net

I want the same result in .Net too but not succeed yet.

  1. I have taken two string variables and directly compare with "==" with each other which gave me "false" result
  2. Checked with String.Equal with StringComparison parameter and result is "false" only

Any help is appreciated. Thanks!!

Snehal
  • 1,070
  • 12
  • 20
  • It will help to post the code for the .net – mikelegg Mar 04 '21 at 11:50
  • 1
    Does this answer your question? [Ignoring accented letters in string comparison](https://stackoverflow.com/questions/359827/ignoring-accented-letters-in-string-comparison). Just place the culture you need to use (`CultureInfo.GetCultureInfo("ru-RU")` for Russian) if your CurrentCulture is not this one. – astentx Mar 04 '21 at 11:56
  • @astentx Thanks. Yes I am getting desired result for above given string. Let me check other Russian strings too. – Snehal Mar 04 '21 at 12:48
  • @Snehal You're welcome. As I can imagine, you need to check `Й` and `И` not bo be equal, since they have different meaning in Russian (and play different roles in word). All other should be fine, there're no more such cases. – astentx Mar 04 '21 at 13:58
  • @astentx Thanks you for information. Actually I don't know Russian. Your suggested thread having two solution, either we can do with RemoveDiacritics function OR compare string with params (culture & IgnoreNonSpace). This both treating Й and И are same characters I believe. so that is wrong right? – Snehal Mar 05 '21 at 04:41
  • @Snehal Yes, they are different. Ё is optional in writings (despite the different pronunciation of Е and Ё), so the word is identified simply. But we never write Й as И. I cannot come up with example of words that can have different meaning after replacement (I mean that in general result of replacement will be "strange" or non-existing and original word can be guessed by related noun), so maybe you can allow such tradeoff for your task assuming this as a very-very rare case. – astentx Mar 05 '21 at 22:27

1 Answers1

1

I guess in the SQL Server DB you have got "Accent Insensitive"-collation which means that all "strange"-letters (like a-umlaut,o-umlaut,u-umlaut in German) are treated like regular ones.You can take a look on the following question with explanations about collation

in sql server, what is: Latin1_General_CI_AI versus Latin1_General_CI_AS

Sorry, but I don't have any idea how you can achieve this in C#

Sergey
  • 4,719
  • 1
  • 6
  • 11