public static string CleanInvalidXmlChars(string text)  
  {  
      // From xml spec valid chars:  
      // #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]    #x2  
      // any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.  
      string re = @"[^\x09\x0A\x0D\x20-\xD7FF\xE000-\xFFFD\x10000-x10FFFF]";  
      return Regex.Replace(text, re, "");  
  } 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yls087412/archive/2009/10/29/4743320.aspx

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
  • 2021-11-28
  • 2021-09-06
猜你喜欢
  • 2021-11-13
  • 2022-12-23
  • 2021-07-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案