Pankaj Mishra
Pankaj Mishra

Reputation: 20358

How to read Arabic text from text file?

I have text file which contains Arabic words. And i using StreamReader to read the text file and and StreamReader not getting those words and return ??????. I tried Binary reader to but it's not reading that. I am using windows application. Please let me know any ways.

Upvotes: 1

Views: 4528

Answers (2)

NourAldienArabian
NourAldienArabian

Reputation: 107

StreamReader sr = new StreamReader(path,Encoding.Default,true);
string dataReader=sr.ReadToEnd();
sr.Close();

try and see it's right

Upvotes: 1

Alberto
Alberto

Reputation: 15951

Try specifying the encoding using this StreamReader constructor:

StreamReader reader = new StreamReader(filePath, System.Text.Encoding.UTF8, true);

For reference: http://msdn.microsoft.com/en-us/library/ms143457.aspx

Upvotes: 2

Related Questions