Unicode(0xb) error-An invalid XML character (Unicode: 0xb) was found in the element content of the document.

问题描述: 今天对接接口的时候,在解析对方的xml时,报了这样一个错误“Unicode(0xb) error-An invalid XML character (Unicode: 0xb) was found in the element content of the document.” 原因分析: 报错提示是说,xml中有一个非法的xml字符(Unicode: 0xb),unicode编码的0xb表示垂直tab( vertical tab,VT),在notepad++之类的文本编辑器中,显示为VT。详情见:https://en.wikipedia.org/wiki/Tab_key。 如有以下unicode编码后的文本: %u63a5%u53d7%0b%u3002 unicdoe解码后,notepad++中的显示,可以看到VT字符: 对于xml 1.0来说,它的合法的字符范围应该是(见:https://en.wikipedia.org/wiki/Valid_characters_in_XML#XML_1.0): XML 1.0 Unicode…