By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,483 Members | 1,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,483 IT Pros & Developers. It's quick & easy.

Encoding problem

P: n/a
Hi all,

I'm using the XmlDocument class to create an XML document. I found out that
in .NET there are special classes that they do that job a lot faster,
namelly XmlTextWritter. My problem is that using the XmlTextWritter the
encoding gets messed up.

How do I set the XmlTextWritter's ecncoding to be the same as the one that
the XmlDocument is using?
I've tried this but doesn't work.

System.IO.MemoryStream s = new System.IO.MemoryStream();

XmlTextWriter LWriter = new XmlTextWriter(s, Encoding.Unicode);
Thanks in advance,
Greg
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Your problem is not specific enough to provide you with any help. Are you
writing the XML to a MemoryStream and then loading the XmlDocument or
something else?

--
This posting is provided "AS IS" with no warranties, and confers no rights.

"Greg" <gg*********@metastorm.NOSPAM.com> wrote in message
news:Om**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I'm using the XmlDocument class to create an XML document. I found out that in .NET there are special classes that they do that job a lot faster,
namelly XmlTextWritter. My problem is that using the XmlTextWritter the
encoding gets messed up.

How do I set the XmlTextWritter's ecncoding to be the same as the one that
the XmlDocument is using?
I've tried this but doesn't work.

System.IO.MemoryStream s = new System.IO.MemoryStream();

XmlTextWriter LWriter = new XmlTextWriter(s, Encoding.Unicode);
Thanks in advance,
Greg

Nov 12 '05 #2

P: n/a
Hi Dare,

Here is the full picture. I use a component written in C# that builds HTML
pages dynamically and then sends the contents together with some headers
bandled up in a XML document (text only) to an ISAPI via COM. When it
reaches the ISAPI I set the headers and contents of the Response object form
the XML document and send it to the browser.

That XML document is the one that gives me trouble. When I use the
XmlDocument class to create it it works fine. But, when I use the
XmlTextWriter pages in the browser appear to contain some weird caracters.

Thanks,
Greg.
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.