Dennis S

Dennis S

  • NA
  • 102
  • 2.1k

Export Non-englisg data in CSV

May 17 2007 8:39 AM

hi,

  I trying to export data display on a gridview that supports any language (like chinese, japanese, thai, french) shown here is chinese only. There is no problem exporting english language data, problem starts exporting non-english data using approach shown below, the data is retrieve in database in an xml format. Is there a simple way to be able to make this work? Hopefully somebody here can help me...


Response.ContentEncoding = System.Text.Encoding.UTF8;

Actual Result:

 é¡¹ç›®åŠžå…¬å®¤

Desired Result:

 ?????

  

//Codes exporting data

StringBuilder sb = null;
			sb = ExportAssessmentData();

			if (sb != null)
			{
				Response.ContentEncoding = System.Text.Encoding.UTF8;
				Response.ClearContent();
				Response.ClearHeaders();
				Response.ContentType = "text/comma-seperated-values";
				Response.AddHeader("Content-Disposition", "Attachment;FileName=AssessmentListData.csv");
				Response.Write(sb.ToString());
				Response.Flush();
				Response.Close();
			}


  //Create string builder data

int iColCount = grdList.Columns.Count;
		for (int i = 0; i < iColCount; i++)
		{			
			sb.Append(grdList.Columns[i].HeaderText);
			if (i < iColCount - 1)
			{
				sb.Append(",");
			}
		}
		sb.Append(Environment.NewLine);