2011-01-17 6 views
0

私はデータベースから中国のデータをダウンロードしようとしています。しかし、データは、この中国語の印刷に望ましくない文字をダウンロードするには?

œèŽžå¸,诚通计ç®-机技术å'¨è¯¢æœåŠ¡æœ‰é™å...¬AのようにExcelで異なるcharectersに来ています¸

ここで私のダウンロードコードはExcelです。自分のコードで何が間違っているのか分かりません。

dg.AllowPaging = False 
     dg.AllowSorting = False 
     dg.AllowCustomPaging = False 
     dg.AutoGenerateColumns = True 

     dg.HeaderStyle.Font.Bold = True 
     dg.HeaderStyle.Font.Underline = True 

     dg.DataSource = sqlDs.Tables(0) 
     dg.DataBind() 
     dg.RenderControl(htmlWrite) 

     Response.Clear() 
     Response.ClearContent() 
     Response.AddHeader("content-disposition", "attachment;filename=FullExtract_" & Now.Year.ToString & Now.Month.ToString & Now.Day.ToString & ".xls") 
     Response.ContentType = "application/octet-stream" 
     'Response.ContentType = "application/excel" 
     Response.BinaryWrite(System.Text.UnicodeEncoding.UTF8.GetBytes(stringWrite.ToString())) 
     Response.End() 

答えて

1

はChineeseにしようとしていないが、私はトルコのdata.Theコードは、下記の私のためによく働くと同様の問題を抱えていました。詳細情報hereがあります。お役に立てれば。

Response.Clear(); 
Response.AddHeader("content-disposition","attachment;filename=Test.xls"); 
Response.ContentType = "application/ms-excel"; 
Response.ContentEncoding = System.Text.Encoding.Unicode; 
Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble()); 

System.IO.StringWriter sw = new System.IO.StringWriter(); 
System.Web.UI.HtmlTextWriter hw = new HtmlTextWriter(sw); 

FormView1.RenderControl(hw); 

Response.Write(sw.ToString()); 
Response.End(); 
関連する問題