後臺封裝的easyui框架,處理texbox的時候報錯:未結束的字符串常量。

緣由:特殊字符致使json字符串轉換成json對象出錯json

解決:找到初始值的地方進行過濾spa

代碼以下:對象

           theString = theString.Replace(">", ">");  字符串

           theString = theString.Replace("<", "&lt;");  string

           theString = theString.Replace(" ", "&nbsp;");  class

           theString = theString.Replace("\"", "&quot;");  co

           theString = theString.Replace("\'", "&#39;");  字符

           theString = theString.Replace("\\", "\\\\");//對斜線的轉義  

           theString = theString.Replace("\n", "\\n");  

           theString = theString.Replace("\r", "\\r");  

相關文章
相關標籤/搜索