473,290 Members | 1,897 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,290 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 2449
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.