Example of transferring xml escape characters using ascii code
- 2020-12-09 00:49:27
- OfStack
Today, my colleague said that I would transmit the encrypted 1 piece of character through XML, but XML cannot transmit escape characters. What should I do?
Just use the ASCII code.
// into ASCII code
string old = "j\n\f}m\b|\t?gWZMMIVO";
char[] cs = old.ToArray();
string temp="";
foreach(char a in cs)
{
temp += ((int)a).ToString() + ",";
}
// Change character
string newstr="";
string[] tp = temp.Split(',');
foreach(string st in tp)
{
if(""!=st)
newstr += (char)(short.Parse(st));
}