Wrong output arabic data
I read data form SQL server which have arabic data , then write it to text file, the arabic data appear ???? in the text file while I use the following code:
TextWriter
writer = new StreamWriter(path, false, Encoding.GetEncoding("windows-1256"));
any suggestion please
Note: I can read the arabic data correctly in sql
I use c# 2005 and read from sql server 2000
Kirtan PatelPosted Nov 8, 2009, 12:02 AM
You should Write Text File With Following Code so it will Show Arabic in Text Files
and make also sure that you store the data in nvarchar datatype in sql Server
private void button1_Click(object sender, EventArgs e)
{
string SampleData = "" ;
StreamWriter sw = new StreamWriter("File.txt",true,Encoding.Unicode);
sw.Write(SampleData);
sw.Close();
}
if my answer helps you then check "Do you like this answer" check box :)