c# - Decode hex chars in string -
from 3rd part string "123123"
sick have wrap xml error system.argumentexception: '', hexadecimal value 0x04, invalid character.
can either decode hex value meaningful, or delete it. solution must able handle other hex values well.
i ended creating method
public static string removeinvalidxmlchars(string str) { var sb = new stringbuilder(); var decodedstring = httputility.htmldecode(str); foreach (var c in decodedstring) { if (xmlconvert.isxmlchar(c)) sb.append(c); } homecoming sb.tostring(); }
c# xml character-encoding
No comments:
Post a Comment