HTML5 documents: encode - declare - decode
Encoding HTML5 documents
You should always specify the character encoding set used to encode your document for the web browsers to know which character set to use to decode it in order to render properly.
The HTML5 documents should be:
- properly encoded: e.g. in your text editor (Notepad++), Dreamweaver,...
- properly declared: e.g. specifying the character encoding set used either at document level either at server level
- properly decoded: e.g. test in browser (Firefox: View → Character Encoding)
Video demonstration HTML5 documents encode, declare, decode
HTML5 documents encode, declare, decode Tutorial
|00:00||encode, declare, decode HTML5 documents video demonstrations|
|00:02||character sets |
Why it is so important to properly encode and declare the characater encoding set used by your HTML document ?
|00:10||let's add the very basics of an HTML page, containing both ASCII and non-ASCII characters|
|00:21||let's encode it UTF-8|
|00:27||without declaring it, let's test it in browser|
|00:35||different characters display in browser|
|00:40||the browser picked it up as Western instead of Unicode encoding and the special characters (non-ASCII) displayed garbled|
|00:45||let's declare that we encoded our document UTF-8|
|00:53||the browser now picks it up as Unicode (UTF) and our non-ASCII characters display properly|
|01:04||Note: Always pay attention on the encoding set used when you save your document, in order to know what to declare for the e.g. browsers toknow how to decode it|