User1452071630 posted
Hello, I like to offer a posibility to download a CSV-Textfile at a webpage. The download data is only available as a string and not as a file (so I can't use somethin like FileStream). I tried different way's but im my downloaded file the special characters
are replaced with two chars like 'ü' (means ü) -> 'ü'. Is there a solution out there? aspx-File:
... Context.Response.Clear(); Context.Response.BufferOutput = true; Context.Response.AddHeader("Content-Disposition", "attachment; filename=test_BM.csv"); Context.Response.ContentType = "text/comma-separated-values"; //Context.Response.ContentType = "application/octet-stream";
Context.Response.Charset = "iso-8859-1"; strExportLine = "test äöüß test"; Context.Response.Output.Write(strExportLine + Environment.NewLine); Context.Response.Flush(); ...
Web.config: <globalization requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="ISO-8859-1" culture="de-DE" uiCulture="de-DE"/>
Thanks Andreas
User1452071630 posted
Hi all, I got a solution. Context.Response.ContentEncoding = System.Text.Encoding.GetEncoding( "iso-8859-1" );
Maybe someone needs this too. Andreas