| etc" />
开发者

xml utf-16 issue

开发者 https://www.devze.com 2022-12-17 10:45 出处:网络
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

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[] encoded开发者_如何学JAVAString = Encoding.ASCII.GetBytes(strRequest);

I need it in a utf8 format, without the "dots".

Thx


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消