Thread: XML Encode Help.

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    48

    XML Encode Help.

    Hi all,

    i am develop a small tool with C# for converting the ASCII format xml file to UTF-8 format.

    What's the different for the below two line? Which one is better to use.

    <?xml version="1.0" encoding="us-ascii"?>

    <?xml version="1.0" encoding="ascii"?>

    Code:
                XmlDeclaration xmldecl;
    
                ......
    
                xmldecl = doc.CreateXmlDeclaration("1.0", "us-ascii", null);
    Thanks in advance.


    BR!

    Pingz
    Last edited by userpingz; 10-29-2009 at 02:50 AM. Reason: add code
    --------------------------------------------------------
    Newbie
    C/C#/C++
    swimming/cycling/running
    There is nothing more powerful than an idea.
    Except for an idea put into action.
    --------------------------------------------------------

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Neither of them, don't you think?
    If you want to use UTF-8 encoding you use:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    ascii is a subset of UTF-8 and us-ascii is simply another name for ascii.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    48

    Smile

    Quote Originally Posted by Mario F. View Post
    Neither of them, don't you think?
    If you want to use UTF-8 encoding you use:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    ascii is a subset of UTF-8 and us-ascii is simply another name for ascii.

    Thank you Mario. :-)
    --------------------------------------------------------
    Newbie
    C/C#/C++
    swimming/cycling/running
    There is nothing more powerful than an idea.
    Except for an idea put into action.
    --------------------------------------------------------

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Parsing Xml
    By deviousdexter in forum C# Programming
    Replies: 7
    Last Post: 04-24-2009, 06:29 AM
  2. Dissecting an Excel XML spreadsheet
    By desmond5 in forum C++ Programming
    Replies: 1
    Last Post: 05-22-2008, 04:32 PM
  3. XML encoding issue
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-16-2008, 05:21 AM
  4. XML and data exchange
    By seexml in forum C Programming
    Replies: 0
    Last Post: 04-27-2006, 03:02 PM
  5. Need help with this xml tree example
    By kzar in forum C Programming
    Replies: 1
    Last Post: 11-22-2004, 11:23 AM