Hmm, this is a difficult one. I pasted your code into VS 2010, using .NET 4.0, and adapted it slightly (removing parts not immediately related to the problem, eg. the file I/O), and it's running as expected. The words are correctly split into 3 elements, the number of spaces separating them does not make a difference.
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
English();
Arabic("مرحبا0 مرحبا1 مرحبا2");
Arabic("مرحبا0 مرحبا1 مرحبا2");
Console.ReadLine();
}
private static void English()
{
Console.WriteLine("---------English---------");
string[] ss2;
string[] ssFeedo = new string[2000];
ssFeedo[0] = "hellow0 hellow1 hellow2";
ss2 = ssFeedo[0].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
Console.WriteLine("ss2[0]=" + ss2[0] + " ss2[1]=" + ss2[1] + " ss2[2]=" + ss2[2] + "\n");
if (ss2.Length == 3)
{
Console.WriteLine("Correct");
}
}
private static void Arabic(string text)
{
Console.WriteLine("---------Arabic---------");
string[] ss2;
string[] ssFeedo = new string[2000];
int J = -1;
ssFeedo[0] = text;
ss2 = ssFeedo[0].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
Console.WriteLine("ss2[0]=" + ss2[0] + " ss2[1]=" + ss2[1] + " ss2[2]=" + ss2[2] + "\n");
if (ss2.Length == 3)
{
Console.WriteLine("Correct");
if (ss2[2] == "مرحبا2")
{
J = 20;
Console.WriteLine("J=" + J.ToString() + "\n");
}
}
}
}
}
In each of the Arabic text cases J is indeed set to 20.
Would you mind trying this little app on your system (it's a console application), and verifying if you're also getting correct output? Granted, the Arabic characters display as question marks in the console window, but the contents of the variables is nevertheless correct, as verified under a debugger.
If you don't get the same results, then I'm wondering whether our systems may perhaps differ in terms of some regional settings.
My output:
---------English---------
ss2[0]=hellow0 ss2[1]=hellow1 ss2[2]=hellow2
Correct
---------Arabic---------
ss2[0]=?????0 ss2[1]=?????1 ss2[2]=?????2
Correct
J=20
---------Arabic---------
ss2[0]=?????0 ss2[1]=?????1 ss2[2]=?????2
Correct
J=20