Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Encoding And Xhtml Requirements

Recommended Posts

OK, so after reading a lot of contradicting information I decided to ask. How should document encoding be announced? The W3C validator (or at least links from the same upon a missing encoding) suggests the server should send the encoding in the content-type header. The problem with this that I see is that you can't always make a blanket judgment about what encoding pages will be in. Is it simply suggested to use .htaccess files (or equivalent) for this, then? I am led to believe that most (all?) browsers will ignore a content-type meta tag. Is there another in-file option? An attribute in an xml or html tag? But doesn't a client need to know what encoding a file is before it can parse it?Secondly, and (in my mind at least) on a related note, what are the exact requirements for a page to be XHTML? I see a lot of talk about using <?xml ?> tags with various attributes, and using an xmlns attribute, and that the <?DOCTYPE > is simply there for validators. Well, even if the <!DOCTYPE > is soley for validators, the W3C validator doesn't complain about my lack of xmlns or anything, so are these actually required?I'd appreciate any elaboration on these subjects.

Share this post


Link to post
Share on other sites

Secondly, and (in my mind at least) on a related note, what are the exact requirements for a page to be XHTML? I see a lot of talk about using <?xml ?> tags with various attributes, and using an xmlns attribute, and that the <?DOCTYPE > is simply there for validators. Well, even if the <!DOCTYPE > is soley for validators, the W3C validator doesn't complain about my lack of xmlns or anything, so are these actually required?

XHTML 1.1 must be served with the XML prologue (<?xml version="1.0" encoding="UTF-8" ?>). With this prolog, pages must be served with the application/xml+xhtml MIME type (that's the meta http-equiv="Content-Type"...). Unfortunately, IE (and that's going to include IE7 too) doesn't support serving pages with this MIME type. For IE, you have to use text/html.
So for that reason, it's advisable to serve your pages as XHTML 1.0 which doesn't require the XML prologue. Either that or use a browser sniffing script to serve up different MIME/DOCTYPES.

Share this post


Link to post
Share on other sites

I know that in order to use <xml> docs you need xhtml to start it up, xml is move server side database stuff then something like css, closely they resemble but both require different attributes and different code to work properly.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.