Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > Usability

  • Print
  • + Share This
This chapter is from the book

Declaring the Encoding

All text documents, (X)HTML files included, are saved with a character encoding. Since there are many encodings in use in the world, it's a good idea to declare which encoding your page was saved in right in the (X)HTML code. This makes it easier for browsers on systems with different default encodings to view the characters in your pages correctly.

To declare the character encoding

In the head section of your page, type <meta http-equiv="content-type" content="text/html; charset=encoding" />, where encoding is the character encoding with which you saved the file.


Figure 3.4 I've saved my files in Unicode, with the UTF-8 encoding. (This is BBEdit. For more details about saving files with encodings other than the default for your system, consult Chapter 20, Symbols and Non-English Characters.)

Example 3.5. When the visitor's browser sees this meta tag, it will know that the page was encoded with UTF-8, and will display it properly. The key is that the encoding that you declare in the meta tag match the one with which you actually saved the file.

1.0 Transitional//EN"


<html xmlns="">


<meta http-equiv="

   content-type" content="text/html; charset=utf-8" />


  • + Share This
  • 🔖 Save To Your Account