Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,383
    Thanks
    264
    Thanked 32 Times in 31 Posts

    changing from ISO-8859-1 to UTF-8

    When changing from ISO-8859-1 to UTF-8 in a pre-existing html document (1.0 transitional).

    Is it better to change the xml declaration or is it better to remove the xml declaration and just use the meta tag to assign UTF-8? Is there a preferred method?

    I had always thought that the xml declaration was always required regardless, but i have seen some documents without it and those have the meta tag.

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    or
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  • #2
    Regular Coder COBOLdinosaur's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    411
    Thanks
    2
    Thanked 32 Times in 32 Posts
    If it is am HTML document then use the meta tag. For XHTM you can use either. If you are not already migrating to HTML5 you should think about starting that. XHTML is deadended and browswers may not recognize the latest HTML enhancement without old HTML doctypes.
    Last edited by COBOLdinosaur; 03-10-2014 at 11:32 PM.
    100% standards compliant code is 100% correct 100% of the time.
    one of my toys from my repository and perhaps some help getting help

    Cd&

  • Users who have thanked COBOLdinosaur for this post:

    durangod (03-12-2014)

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Location
    MS
    Posts
    837
    Thanks
    10
    Thanked 79 Times in 77 Posts
    Using a XHTML Transitional document type gives you a lot of leeway as to what you can use. It's very forgiving.

    An XML declaration is not required in all XML documents. Only a well-formed XML document will have it.

    The encoding declaration, <?xml version="1.0" encoding="UTF-8"?> is optional. If used, the encoding declaration must appear immediately after the version information in the XML declaration, and must contain a value representing an existing character encoding.

    An XML declaration can also contain a standalone declaration, for example, <?xml version="1.0" encoding="UTF-8" standalone="yes"?>. Like the encoding declaration, the standalone declaration is optional. If used, the standalone declaration must appear last in the XML declaration.
    ☠ ☠RON☠ ☠


  •  

    Posting Permissions

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