I create a text file with ANSI format and write persian word in that, now I read that with this code:
System.Net.WebClient wc = new System.Net.WebClient();
string textBoxNewsRight2Left = wc.DownloadString("http://dl.rosesoftware.ir/RoseSoftware%20List/Settings/News.Settings.txt");
MessageBox.Show(textBoxNewsRight2Left);
but I see ???????????????????? character!
I change file format to UTF8 and my problem fix with persian word, but again I find another problem this time with english word!
once again I use from this codes with UTF8 format file:
System.Net.WebClient wc = new System.Net.WebClient();
string textBoxNewsRight2Left = wc.DownloadString("http://dl.rosesoftware.ir/RoseSoftware%20List/Settings/News.Settings.txt");
MessageBox.Show(textBoxNewsRight2Left);
Now I see: "ÿþr" and I don't see my file words!
Now I use:
wc.Encoding = Encoding.Unicode;
Now I see my file words! without "ÿþr".
I don't think I have in original file hello and after read by C# I have hello now I test equaling textBoxNewsRight2Left and hello
if (textBoxNewsRight2Left == "hello")
{
MessageBox.Show("Equal");
}
else
{
MessageBox.Show("Not Equal");
}
Now I see message Not Equal, but I see hello!
what is the problem?
I how can fix this problem?