tags:

views:

46

answers:

0

i m trying to generate an excel file from my web page but i have some issues with Turkish chars such as "İ" "ğ" when i open the file some chars are incorrect (İ seems Ä°) here is my code

    gvExpRequests.DataSource = dsExpRequests;
    gvExpRequests.DataBind();
    gvExpRequests.GridLines = GridLines.Both;
    Page.EnableViewState = false;
    Response.Clear();
    Response.AddHeader("content-disposition", "attachment;filename=export.xls");
    Response.ContentType = "application/ms-excel";
    Response.ContentEncoding = Encoding.UTF8;
    Response.BinaryWrite(Encoding.UTF8.GetPreamble());
    StringWriter yaz = new StringWriter();
    HtmlTextWriter htw = new HtmlTextWriter(yaz);
    gvExpRequests.RenderControl(htw);

i don't know what's wrong with here i tried a lot of encoding but i got same results every time i want to try something different to do this are there any another way to export a excel file from a gridview