2005年9月23日

Bug in template


I found a bug in template of this blog.
Information about this template was as follow:

Blogger Template Style
Name: Thisaway (Rose)
Designer: Dan Rubin
URL: www.superfluousbanter.org
Date: 29 Feb 2004


In this template, there was line that look like following:

<head>
  <title><$BlogPageTitle$></title>
  <$BlogMetaData$>

This part was at very beginning.


This works fine for Thunderbird, but did not work fine for IE.
The reason was pretty simple. It's because I was using non-ascii character on title. I'm using UTF-8.


As you might notice, UTF-8 and ASCII are compatible for first 128 characters.
Therefore, even if header parts are like above, as long as blogger are using ascii base characters for it's title, no problem arise. But what will happen if I used characters like ... Kanji, for example.


Since HTML assume default character set to be ASCII, HTML Brouser have right to assume non-ascii character to be what they BELIEVE. IE on Windoes XP-SP1 Japanese edition, assumed characters to be Shift JIS. And as result, views were all messed up.


Solutions were pretty simple. What we needed was the following line before the title:


  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


This line was generated by <$BlogMetaData$> line at the beginning. This line needed to be before <title><$BlogPageTitle$></title> the title line.


So comes the solution. Change the template from


<head>
  <title><$BlogPageTitle$></title>
  <$BlogMetaData$>


to


<head>
  <$BlogMetaData$>
  <title><$BlogPageTitle$></title>


And you'll have happy life.

0 件のコメント:

コメントを投稿