How to prevent System.Xml.XmlException: Invalid character in the given encoding

前端 未结 4 1782
心在旅途
心在旅途 2020-11-30 11:35

I have a Windows desktop app written in C# that loops through a bunch of XML files stored on disk and created by a 3rd party program. Most all the files are loaded and proce

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-30 12:03

    Not sure if this is your case, but this can be related to invalid byte sequences for a given encoding. Example: http://en.wikipedia.org/wiki/UTF-8#Invalid_byte_sequences.

    Try filtering invalid sequences from the file while loading.

提交回复
热议问题