XML Encode Help.

This is a discussion on XML Encode Help. within the C# Programming forums, part of the General Programming Boards category; Hi all, i am develop a small tool with C# for converting the ASCII format xml file to UTF-8 format. ...

  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 03: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
    Portugal
    Posts
    7,578
    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.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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, 07:29 AM
  2. Dissecting an Excel XML spreadsheet
    By desmond5 in forum C++ Programming
    Replies: 1
    Last Post: 05-22-2008, 05:32 PM
  3. XML encoding issue
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-16-2008, 06:21 AM
  4. XML and data exchange
    By seexml in forum C Programming
    Replies: 0
    Last Post: 04-27-2006, 04: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21