+ Reply to Thread
Results 1 to 2 of 2

Thread: Parsing strange characters iinto XML

  1. #1

    Parsing strange characters iinto XML

    Today i had a problem and it was parsing strange characters into XML , strange characters like Chinese symbols and that kind of characters.

    I don't know much about coding , can u help me out ?
    Last edited by csharpmaster; 11-08-2012 at 10:35 PM.

  2. #2
    Junior Member
    Join Date
    May 2012
    Posts
    36
    Solution Steps :
    1- Read the text
    2- Convert it to UTF8 Encoding
    3- Convert the UTF8 Encoded text to string

    That was the solution of the problem because when you UTF8 Encode these characters and use the same Encoding on the XML file then you won`t face any problems.

    Code :
    Code:
                            byte[] FilestoBytes = System.Text.Encoding.UTF8.GetBytes("Normal String");
                            string utf8 = System.Text.Encoding.UTF8.GetString(FilestoBytes);
    
                            XmlElement FileName = xml.CreateElement("EncodedText");
                            FileName.InnerText = utf8;
                            ROOT.AppendChild(FileName);

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts