Ext Json 缺少16进制数字

在用Grid显示数据库中表的内容时碰到这个错误,
脚本错误:
缺少16进制数字

这个错误是由于JS脚本被打乱所致,虽然一开始注意到了换行符的问题,
经过一番查找 Ext  Json   缺少16进制数字 - kogu - kogu的博客,确定是由于表中有一个字段是存文件路径的,其中有   \\   的写法,
这个无论是用 C#中的HttpUtility.HtmlEncode() 转码,还是用
JS转码,如:
function HTMLEncode ( input )
{
    var converter = document.createElement("DIV");
    converter.innerText = input;
    var output = converter.innerHTML;
    converter = null;
    return output;
}
都无法处理,最后只能在C#代码里如下处理了:
item.ToString().Replace("\\","/").Replace("//","/")

你可能感兴趣的:(json,脚本,C#,ext,input,output)