Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
03-09-2014, 08:03 AM #1
- Join Date
- Nov 2010
- 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.
<?xml version="1.0" encoding="UTF-8"?> or <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
03-10-2014, 11:25 PM #2
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.
Users who have thanked COBOLdinosaur for this post:
03-19-2014, 06:15 PM #3
- Join Date
- Aug 2005
- 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☠ ☠