CHAPTER 3 WEB VOCABULARIES (Web hosting isp) CHOOSING AN ENCODING
CHAPTER 3 WEB VOCABULARIES CHOOSING AN ENCODING UTF-8 is a Unicode character set that supports the first 128 ASCII characters, as well as additional charac- ters. Documents using only simple ASCII characters can use UTF-8 encoding. The basic ASCII character set doesn t include European characters that include accents, and the numeric values for each character may vary depending on the specified encoding. If you re running an English version of Windows, your default encoding is compatible with ISO-8859-1. This encoding is supported widely, so changing the encoding declaration to ISO-8859-1 allows European characters to display correctly. Encoding rules are often complex. XML supports UTF-8 and UTF-16 encoding by default. UTF-16 is a large character set that includes many Chinese and Japanese characters, among others. In order to have numeric values for all of the characters, it uses two or more bytes for each character, instead of one byte as in UTF-8 and ASCII. Simple text editors may not support encoding other than UTF-8 or ASCII. For more infor- mation about different encoding specifications, visit http://www.unicode.org/. Again, this line tells the browser what type of content the document contains. In the preceding tag, you specify text/html as the document type and ISO-8859-1 as the encoding. If a document contains both the XML declaration and the element, the browser uses the encoding value in the XML declaration. Browsers that don t support the XML declaration use the value. You can also use the HTTP header Content-Typeto specify encoding on the web server. This approach provides the most reliable way to specify the encoding in an XHTML document. You can set the header using any server-side technology. Specifying Language HTML 4.0 and XHTML 1.0 allow you to specify the language for a document or element using the lang attribute. Web browsers can use this information to display elements in language- specific ways. For example, hyphenation may change depending on the language in use. Additionally, screen readers may read the text using different voices, depending on the language specified. The following langattribute specifies the U.S. version of English as the language for the document:
You can find out more about which attribute values to use at http://www.w3.org/TR/ REC-html40/struct/dirlang.html. XHTML 1.1 replaces the lang attribute with xml:lang. In addition to XHTML, many other web vocabularies use this attribute from the xml namespace. This makes XHTML much more compatible with other XML applications. If you want a quick refresher on namespaces, see the section, Understanding the Role of XML Namespaces, in Chapter 2.In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.