xml utf-16 问题
我通过 http 请求接收 xml。格式是这样的 "<.?.xml .version=.\".1...0.\". .encoding=.\".utf-.1.6.\".?.>| 等
然后我收到错误:{“名称不能以 '.' 开头字符,十六进制值0x2E。第 1 行,位置 2。"}
尝试将其转换为 ascii 像这样,也不能解决问题。 byte[]encodedString = Encoding.ASCII.GetBytes(strRequest);
我需要 utf8 格式,没有“点”。
谢谢
I am receiving a xml through a http request. The format is like this "<.?.x.m.l. .v.e.r.s.i.o.n.=.\".1...0.\". .e.n.c.o.d.i.n.g.=.\".u.t.f.-.1.6.\".?.>| etc
Then i'm getting an error: {"Name cannot begin with the '.' character, hexadecimal value 0x2E. Line 1, position 2."}
Trying to convert it to ascii like this, doesn't solve the issue either. byte[] encodedString = Encoding.ASCII.GetBytes(strRequest);
I need it in a utf8 format, without the "dots".
Thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果它是有效的 UTF-16,则每个“点”的格式应为 \x00。但从你的错误来看,你的所有 \x00 似乎都被 \x2E 替换,似乎是复制粘贴的产物。
确保您从源获取的数据未经修改。这可能足以让您打开 XML 文件。
If it's valid UTF-16 the format each "dot" should be a \x00. But from your error it seems all your \x00 is replaced by \x2E, seems to be an artifact of copy-and-paste.
Make sure you get the data from the source unmodified. This may be enough for you to open the XML file.