传递中文之前,将要传递的中文参数进行编码,在接收时再进行解码。
传递时编码:
string keyword=this.txtSeek.Text.Trim(); this.Response.Redirect("~/product/product_list.aspx?keyword="+Server.UrlEncode(keyword));
如果此时传递的是中文"我",则地址栏显示:
product/product_list.aspx?keyword=%e6%88%91
接收时解码:
string keyword=Server.UrlDecode(Request.QueryString["KeyWord"]);
本文介绍了在网页应用中如何处理中文参数的传递。通过编码和解码技术确保了中文字符能在URL中正确传输。文章展示了具体的编码实现代码,并解释了在不同阶段如何进行编码与解码。
882

被折叠的 条评论
为什么被折叠?



