后台封装的easyui框架,处理texbox的时候报错:未结束的字符串常量。
原因:特殊字符导致json字符串转换成json对象出错
解决:找到初始值的地方进行过滤
代码如下:
theString = theString.Replace(">", ">");
theString = theString.Replace("<", "<");
theString = theString.Replace(" ", " ");
theString = theString.Replace("\"", """);
theString = theString.Replace("\'", "'");
theString = theString.Replace("\\", "\\\\");//对斜线的转义
theString = theString.Replace("\n", "\\n");
theString = theString.Replace("\r", "\\r");