xml utf-16 问题

发布于 2024-08-19 04:55:05 字数 291 浏览 11 评论 0原文

我通过 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

櫻之舞 2024-08-26 04:55:05

如果它是有效的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文