using-utf-8

Revision as of 19:19, 3 January 2009 by Brian (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)

Jump to: navigation, search

Using UTF-8

Many folks using and authoring microformats have found that consistent use of UTF-8 in the toolchain helps ensure that microformatted international content (i.e. with non-ASCII7 characters) is preserved from publication to indexing to aggregation and addition to desktop applicaions. (You could say I personally have some incentive to get this to all work properly, or rather, that I end up being a good test case ;) Tantek Çelik

Contents


Tips

HTML

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

e.g. here is a complete valid XHTML 1.0 Strict UTF-8 document

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
     <meta http-equiv="content-type" content="text/html; charset=utf-8" />
     <title>Valid XHTML 1.0 UTF-8 document</title>
 </head>
 <body>
 
 </body>
 </html>

Sidenote: this (meta http-equiv) is perhaps the *only* meta tag worth using in an (X)HTML document.

Web Server

Make sure that you have configured the web server to also send the character set as UTF-8 for HTML documents. E.g. for Apache, you can put this in your .htaccess file:

 AddType 'text/html; charset=UTF-8' .html

Middleware

Database

using-utf-8 was last modified: Wednesday, December 31st, 1969

Views