【发布时间】:2014-02-28 17:12:45
【问题描述】:
以下标记显示了我的表单:
<div id="category-form">
</div>
以下代码是我的脚本:
<script type="text/javascript">
function clicked(o) {
var id = o.getAttribute("data-categoryId");
var name = o.getAttribute("data-categoryName");
var description = o.getAttribute("data-description");
loadFormView("/Admin/_EditCategories?categoryId="+ id + "&categoryName="+name+"&description="+description);
}
function loadFormView(url) {
$.ajax({
url: url,
type: 'GET',
cache: false,
success: function (data) {
$("#category-form").html(data);
alert(data);
}
});
}
</script>
我还创建了一个将数据传递给视图的控制器:
public PartialViewResult _EditCategories(int categoryId, string categoryName, string description)
{
Category category = new Category();
category.CategoryId = categoryId;
category.CategoryName = categoryName;
category.Description = description;
ViewBag.Action = "Cập nhật";
ViewBag.Task = "Sửa thể loại truyện";
ViewBag.IsEdit = true;
return PartialView("_TaskCategories", category);
}
当视图呈现 ViewBag 内容并在 IE 上呈现时,文本会出现乱码,而在 Chrome 和 Firefox 上,文本会以越南语正确显示。
“Truyện cười”是 categoryName 的值
在 ie 上的文本框中:“Truy?n c??i”和.... 在 ff 或 chrome 上:“Truyện cười"
如何修复 IE 中的文本渲染问题?提前谢谢!
【问题讨论】:
标签: javascript jquery ajax unicode