Why comparing two equal Persian words does not return 0?

We have two identical letters "ی" and "ي", which became the first main letter after seven windows.
Back to the old XP, we had the second as the main one.
Now the inputs that I get are defined as different if one client is on Windows XP and the other on windows seven.
I also tried to use Persian culture without success. Am I missing something?
EDIT: Had to change the words for a better understanding. Now they look alike.

foreach (CompareOptions i in Enum.GetValues(new CompareOptions().GetType()).OfType<CompareOptions>()) 
    Console.WriteLine( string.Compare("محسنين", "محسنین", new CultureInfo("fa-ir"), i) + "\t : " + i );

Outputs:

-1       : None
-1       : IgnoreCase
-1       : IgnoreNonSpace
-1       : IgnoreSymbols
-1       : IgnoreKanaType
-1       : IgnoreWidth
1        : OrdinalIgnoreCase
-1       : StringSort
130      : Ordinal
+5
source share
2 answers

Two lines are not equal. The last letter is different.

, IgnoreCase -1, OrdinalIgnoreCase 1:

  • OrdinalIgnoreCase
  • IgnoreCase .

, IgnoreCase "" , , , , . , " " .

, InvariantCulture :

foreach (CompareOptions i in Enum.GetValues(new CompareOptions().GetType()).OfType<CompareOptions>()) 
    Console.WriteLine( string.Compare("محسنی", "محسني", CultureInfo.InvariantCulture, i) + "\t : " + i );

1 IgnoreCase OrdinalIgnoreCase.

:
- . .

foreach(var value in strings.Select(x => x.ToCharArray().Select(y => (int)y)))
    Console.WriteLine(value);

:

1605
1581
1587
1606
1610 // <-- "yeh": ي
1606

1605
1581
1587
1606
1740 // <-- "farsi yeh": ی
1606

, , , , .

+5

My Code Characters "ي, ك" "ی, ک", :

 private static readonly string[] pn = { "ی", "ک" };
    private static readonly string[] ar = { "ي", "ك" };
    public static string ToFaText(this string strTxt)
    {
        string chash = strTxt;
        for (int i = 0; i < 2; i++)
            chash = chash.Replace(ar[i],pn[i]);
        return chash;
    }
0

All Articles