Forum Moderators: coopster
It later says my page is not a valid HTML 4.01 Transitional page...
I have a site taht loads up a page then loads up dynamic pages and a menu... what would you use as a doctype? And the encoding, what woud you use for that? How do you possibly know!?
As for character encoding, the key thing is that it matches the actual character encoding. If you are saving your files with software that uses Windows-1252 (you probably aren't unless you're using fairly old software), you need to use that for your character set declaration. There is an excellent "Ask the W3C" article on the subject [webstandards.org] from the Web Standards Project as well as a useful note from the W3C itself [w3.org] that should help you straighten it out.
For more extensive reading, check out the W3C Tutorial on character sets and encoding [w3.org]
Tom
No huge differences between xhtml and html, no big learning curve - read more about it at w3schools.
And if in doubt, just copy the header of ****, try to write valid code, and see if it validates.
Ergophobe: thanks for the wasp article on encodings!
As for my character encoding I use notepad for any HTML and content, and the css file makes all the characters Times New Roman if that makes a difference on which encoding i need.
all the characters Times New Roman if that makes a difference.
No difference at all. The character encoding and the font are independent beasts. The font declaration (be it in html or in an MS Word document) is basically a suggestion to the OS on how a given character should look. The encoding is the code that tells the OS what the character is.
Not to get too specific without know the details of what you're doing, but I'll guess that you are using just the Western European character set and you are working on Windows. In that case the most likely encodings are UTF-8, Windows-1252 or ISO-8859-1.
There is an easy way to tell whether or not you are using Windows-1252 or ISO-8859-1. Create an html page with some of the following characters
- an "oe" ligature
- some curly "quotes"
Now look at in your browser. Set the character encoding to Windows-1252 in your browser. If it looks wrong, you are probably using ISO-8859-01 encoding. If it looks right, you're probably using Windows-1252.
Telling the difference between ISO-8859-1 and UTF-8 is not possible for this character set since ISO-8859-1 and UTF-8 codes overlap fully (i.e. ISO-8859-1 is a subset of UTF-8 and you'll only see differences if you were using something else in the ISO-8859-* family).
I hope that's helpful rather than just confusing.
Tom
IT says for character encoding in html to use the meta tag, so i'm assuming th'ts correct, yet in some examples t hey use is it where the doctype is defined. And with teh doc type, when you add that code is THAT the regular HTML tag or do u put in the required DocType then below that add teh HTML tag?
By the way thanks for taking the time to explain and help :)
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Note also that if you put anything above the doctype, IE6 will drop from 'Strict Mode' to 'Quirks Mode'. In Strict Mode, it displays code according to the standards, more or less, but Quirks Mode is for old HTML pages that are full of unclosed tags and such. It allows for many 'quirks' that still render the page how people were used to seeing in older browsers.
Try to use Strict Mode at all times. Alas this means that if you also use XHTML, you cannot add the XML declaration on the top line, because of IE6.
Be careful saving files from Outlook Express too - it can add a comment at the top of your files that throws IE6 into Quirks Mode! That happened to me once - it took me ages to figure out why my layout was suddenly not displaying as it should.
And if I had both wouldn't that create an error since I have two types? Or is it really how it should be haha.
So that's gonna go up top then make a head tag and put in the meta tag with the encoding (using notepad for all this) correct?
That was the most detailed i've seen yet ^.^
So that's gonna go up top then make a head tag and put in the meta tag with the encoding (using notepad for all this) correct?
Correct.
Best bet for the least pain is this
- use an html4 transitional doctype
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
- use a simple <html> tag without xml or lang attributes
- put the encoding in a meta tag. This should be your first tag after the <html> tag because, once encountered, if the encoding is dfferent from what the browser was expecting, it has to start parsing all over again.
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
Then run it through the validator and see how it goes. If you get errors, try to follow the suggestions offered by the validator. If you can't work it out, post questions about those errors in a new thread over in the HTML forums, since these are really HTML questions.
Good luck!
Tom