The exception that is thrown when the XML is loaded or saved. System.ArgumentException: "(hexadecimal value 0x1d) is an invalid character.
The reason for this is that the XML file contains low nonprinting characters
Processing method: When the XML file is generated, filter low nonprinting characters
Replaces the Low-order ASCII character in a string with the & #x character
Convert ASCII 0-8->-
Convert ASCII 11-12->-
Convert ASCII 14-31->- [HTML] view plain copy return System.Text.RegularExpressions.Regex.Replace (httputilit Y.htmlencode (str), @ "[\x00-\x08]| [\x0b-\x0c]| [\x0e-\x1f] "," "");
[CSharp] View plain copy/// <summary> /// replaces the low-order bit ASCII character in a string character /// conversion ASCII 0 - 8 -> - /// Conversion ASCII 11 - 12 -> - /// Conversion ASCII 14 - 31 -> - /// </summary> /// <param name= "tmp" ></param> /// <returns></returns> Public static string replaceloworderasciicharacters ( string tmp) { StringBuilder info = new StringBuilder (); foreach (char cc in tmp) { int ss = ( INT) cc; if ((ss >= 0) & & (ss <= 8)) | | ((ss >= 11) && (ss <= 12)) | | ((ss >= 14) && (ss <= 32)) info. AppendFormat ("{0:x};", ss); else info. Append (cc); } return info. ToString (); } /// <summary> /// replaces the following characters in a string with the Low-order bit ASCII character /// conversion - -> ascii 0 - 8 /// conversion - -> ascii 11 - 12 /// Conversion &NBSP;&NBSP;&NBSP;-&NBSP;&NBsp;-> ascii 14 - 31 /// </summary> /// <param name= "Input" ></param> /// <returns></returns> public static string getloworderasciicharacters (string input) { if (String. IsNullOrEmpty (input)) return string. empty; int pos, startIndex = 0, len = Input. length; if (len <= 4) return input; stringbuilder result = new stringbuilder (); while (Pos = input. IndexOf ("", startindex) >= 0) { bool needReplace = false; &Nbsp; string roldv = string. Empty, rnewv = string. empty; int le = (Len - pos &NBSP;<&NBSP;6) ? len - pos : 6; int p = input. IndexOf (";", pos, le);