EasyUI入门6 传递中文参数值避免乱码

来源:互联网 发布:知润信息科技有限公司 编辑:程序博客网 时间:2024/05/21 04:40

前台html写法

DisciplineName:encodeURIComponent(row.专业名称),PurchaseNumber:encodeURIComponent($('#PurchaseNumber').textbox('getValue'))

后台c#写法

HttpUtility.UrlDecode(context.Request["DisciplineName"].ToString()); //中文解码HttpUtility.UrlDecode(context.Request["PurchaseNumber"].ToString()); //中文解码

在ajax域内,设置字符集为UTF-8

$.ajax({        contentType: "application/x-www-form-urlencoded; charset=UTF-8",        ……});

html页面也要设置字符集为UTF-8

<head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    ……</head>
阅读全文
0 0
原创粉丝点击