欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

c#导出文件,文件名中文乱码解决方法

程序员文章站 2022-06-23 16:39:20
原文链接:https://www.cnblogs.com/ThreeStone007/p/5401341.html ......
public string clfielname(string filename)
    {
        system.web.httpcontext curcontext = system.web.httpcontext.current;
        string outputfilename = null;
        string browser = curcontext.request.useragent.toupper();
        if (browser.contains("ms") == true && browser.contains("ie") == true)
        {
            outputfilename = system.web.httputility.urlencode(filename);
        }
        else if (browser.contains("firefox") == true)
        {
            outputfilename = "\"" + filename + "\"";
        }
        else
        {
            outputfilename = system.web.httputility.urlencode(filename);
        }
        return outputfilename;
    }

原文链接:https://www.cnblogs.com/threestone007/p/5401341.html