读书人

js解码的有关问题

发布时间: 2013-03-27 11:22:42 作者: rapoo

js解码的问题
$.ajax(
{
type: 'POST',
contentType:"application/x-www-form-urlencoded:charset=utf-8",
cache : false,/*不缓存数据*/
url: 'read.aspx',
dataType: 'html',
timeout: 3000,
error: function()
{

},
success: function(result)
{
editor.setContent([color=#FF0000]decodeURIComponent(result)/color]);
}
});

read.aspx对utf-8的数据编码之后 传到页面
后台是这样写得content = HttpUtility.UrlEncode(content, ncoding.UTF8);
Response.Write(content);


数据库content内容"<p style="text-align:center;"><img style="border-color:black;border-width:1px;" border="1" src="http://imga.360che.com/imga/550x366/0/106/106904.jpg" /></p><p>瑞典斯堪尼亚集团首席执行官雷夫 ? 奥斯汀(Leif ?stling)履历,斯堪尼亚销售(中国)有限公司总经理苏博伦(Peter Sj?blom)履历</p><p>瑞典斯堪尼亚集团首席执行官雷夫 ? 奥斯汀(Leif ?stling)履历,斯堪尼亚销售(中国)有限公司总经理苏博伦(Peter Sj?blom)履历</p></p><p><br /></p>"

解码用decodeURIComponent 只保留了"瑞典斯堪尼"后面的字符串
上面的图片弄丢了
请教应该怎么改? js 解码
[解决办法]
有这种情况?你试试把UTF-8改成gb2312

[解决办法]
没搞明白你为什么要解码,这个又不是地址。
[解决办法]
后台换成Server.HtmlEncode(content);

前台用 HTMLDecode解码试试。
[解决办法]
HttpUtility.UrlEncode这是要干嘛呢?

读书人网 >asp.net

热点推荐