473,326 Members | 2,108 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,326 software developers and data experts.

Xmldocument encoding question.

I have some code like this:

public static string SerializObject(object obj)
{
string xmlString = string.Empty;
using (MemoryStream msReq = new MemoryStream())
{
using (XmlTextWriter wsReq = new XmlTextWriter(msReq, UTF8))
{
XmlSerializer xsR = new XmlSerializer(obj.GetType());
xsR.Serialize(wsReq, obj);
xmlString = new
UTF8Encoding().GetString(msReq.GetBuffer());
}
}
return xmlString;
}

Object obj;
string str = SerializObject(obj) --- Using UTF 8 to do the encoding.

Xmldocument doc = new Xmldocument();
doc.LoadXml(str);
string objStr = doc.InnerText;

Because I found in MSDN, it said all the string are represented as UTF-16.

Here I have a question is:
1. the string str is UTF-16 or UTF -8 ?
2. the string objStr is UTF-16 or UTF -8 ?

Thanks for your help in advance.

Oct 21 '08 #1
0 1682

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Francesc Guim Bernat | last post by:
Dear Colleagues, i'm developing a C++ .NET based application that works with System.Xml library. My problem appears when i try to save a document througt XmlDocument->Save method, because it...
1
by: Francesc Guim Bernat | last post by:
Dear Colleagues, i'm developing a C++ .NET based application that works with System.Xml library. My problem appears when i try to save a document througt XmlDocument->Save method, because it...
2
by: xmlguy | last post by:
This is part of the application that reads XML from file (that has UTF-8) into an XmlTextReader XmlTextReader myXmlReader = new XmlTextReader(args); It then instantiates an object/class...
1
by: Shawn | last post by:
Hi. I'm using a FileStream (instead of just the path to the xml file) to load an XmlDocument. I'm doing this because I need to be able to prevent other processes to update the file I'm working on....
2
by: Eric Cadwell | last post by:
We are encoding strings using XMLElement: private string XMLEncode(string val) { if(val.Length == 0) return string.Empty; XmlElement element = xmldoc.CreateElement("E"); element.InnerText =...
3
by: Dan | last post by:
Is there a better way to include the XML declaration than the following? XmlDeclaration dec =m_XMLDocument.CreateXmlDeclaration("1.0",string.Empty, "yes");...
7
by: Mark | last post by:
Hi... A colleague just referred this question to me. He's getting an xml file from another party, which he's trying to process into another dom using an XmlTextReader and...
0
by: Francisco J. Martinez | last post by:
Hi. Im writing a web service that returns an XML Document that it retrieves from a file in disk or a stream. But the web service always returns the XML document with this header: <?xml...
10
by: lamxing | last post by:
Dear all, I've spent a long time to try to get the xmldocument.load method to handle UTF-8 characters, but no luck. Every time it loads a document contains european characters (such as the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.