user496949
user496949

Reputation: 86075

Can I make xmlreader to use the specific encoding

I can specify encoding in the streamReader. I am wodnering if I cna specify encoding in the xmlReader

Upvotes: 0

Views: 434

Answers (2)

RameshVel
RameshVel

Reputation: 65867

You can use StreamReader with XmlReader.Create, which supports encoding schemes

something like this

var xml  = XmlReader.Create(new StreamReader(file, Encoding.ASCII))

Upvotes: 2

fejesjoco
fejesjoco

Reputation: 11903

I think you can't. Normally, the XML file should contain an encoding at the beginning. You can override this in a StreamReader, but I guess the XmlReader just doesn't deal with that kind of thing.

Upvotes: 0

Related Questions