开发者

I want to export csv file that contains hebrew character in my ASP.net MVC application

I want to export csv file that contains hebrew character in my ASP.net MVC application

I have tried many encoding but not work. Actually hebrew characters and not displaying as they are.

Can anybody have idea?

 System.Text.UnicodeEncoding Enc = new UnicodeEncoding();

        HttpCont开发者_JS百科ext.Current.Response.AddHeader("Content-Length", Enc.GetByteCount(strExport).ToString());
        HttpContext.Current.Response.BinaryWrite(Enc.GetBytes(strExport));
        HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1255");
        //HttpContext.Current.Response.Charset = "iso-8859-8";
        HttpContext.Current.Response.ContentType = "text/csv";
        HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment;inline; filename={0}.csv", fileName));

        HttpContext.Current.Response.End();


Check this out and see if setting the encoding helps: http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx


Once upon a time we had multiple clients, including Hebrew, text files for import into MySQL, Sql Server, etc. The company had standardized on UTF8 as the encoding for everything. That was a few years ago, so ymmv.

Might be easier to debug if you show us a code sample.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜