473,395 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 2454
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ann | last post by:
Hi, Is there any way to Change encoding of Java Vm to ISO-8859-1? i am using Java vm along with an application called opencms. I get the following error message.. Error: the encoding of your...
8
by: janeaustine50 | last post by:
Python's InteractiveInterpreter uses the built-in compile function. According to the ref. manual, it doesn't seem to concern about the encoding of the source string. When I hand in an unicode...
7
by: Mark | last post by:
Hi... I've been doing a lot of work both creating and consuming web services, and I notice there seems to be a discontinuity between a number of the different cogs in the wheel centering around...
8
by: davisjoseph | last post by:
Hi All, I'm newbie to this XML world. My problem is to identify the encoding type of XML at runtime. What currently I'm doing is checking whether BOM is available in the XML; based on the BOM...
8
by: Demon News | last post by:
I'm trying to do a transform (Using XmlTransform class in c#) and in the Transform I'm specifying the the output xsl below: <xsl:output method="xml" encoding="UTF-8" indent="no"/> the...
4
by: fitsch | last post by:
Hi, I am trying to write a generic RSS/Atom/OPML feed client. The problem is, that those xml feeds may have different encodings: - <?xml version="1.0" encoding="ISO-8859-1" ?>... - <?xml...
5
by: James Wong | last post by:
Dear all, I've a web service function and it contains a parameter in System.Text.Encoding. I found that the data type of this parameter in caller application becomes MyWebSvcName.Encoding...
0
by: Janusz Nykiel | last post by:
I've stumbled upon unexpected behavior of the .NET 2.0 System.Xml.XmlWriter class when using it to write data to a binary stream (System.IO.Stream). If the amount of data is less than a certain...
3
by: Martin Z | last post by:
Hi, I have an application that involves sending a lot of XML data to various places. The problem is that once in a while, I just want the XML document as a string (for example, sending to a...
23
by: Allan Ebdrup | last post by:
I hava an ajax web application where i hvae problems with UTF-8 encoding oc chineese chars. My Ajax webapplication runs in a HTML page that is UTF-8 Encoded. I copy and paste some chineese chars...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.