Xmldocument encoding question.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?R2VvcmdlIFNodWk=?=

    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(m sReq, UTF8))
    {
    XmlSerializer xsR = new XmlSerializer(o bj.GetType());
    xsR.Serialize(w sReq, 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.

Working...