tags:

views:

24

answers:

1

Hi

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

+1  A: 

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.

KennyTM
Thanks. But if i display the request with a simple messages box, the result is the same. It looks like the "dots" artifact are coming from the client application
phm
@phm: How about directly write to a file?
KennyTM
@Kenny: tried already. Same result, unfortunately
phm
Looks like the issue is on the "sending side"
phm
Dots are often used to represent \x00 when showing byte values, like next to a hex dump.
Jon Reid