469,609 Members | 1,437 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Encoding problem

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
2 2233
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
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.

Similar topics

2 posts views Thread by Ann | last post: by
8 posts views Thread by davisjoseph | last post: by
8 posts views Thread by Demon News | last post: by
4 posts views Thread by fitsch | last post: by
23 posts views Thread by Allan Ebdrup | last post: by
reply views Thread by Solution2021 | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.