Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我通过 http 请求接收 xml。格式是这样的 "<.?.xml .version=.\".1...0.\". .encoding=.\".utf-.1.6.\".?.>| 等
然后我收到一个错误:{“名称不能以'开头。' 字符,十六进制值 0x2E。第 1 行,位置 2。"}
像这样尝试将其转换为ascii,也不能解决问题。byte[] encodedString = Encoding.ASCII.GetBytes(strRequest);
我需要 utf8 格式,没有“点”。
谢谢
如果它是有效的 UTF-16,则每个“点”的格式应该是 \x00。但是从您的错误看来,您的所有 \x00 都被 \x2E 替换了,这似乎是复制粘贴的产物。
确保从未修改的源中获取数据。这可能足以让您打开 XML 文件。