Jean-Christophe Helary wrote:
> On 27 nov. 2009, at 06:00, JimBreen wrote:
>
> > On Nov 27, 12:31 am, Jean-Christophe Helary
> > <
jean.christophe.hel...@gmail.com> wrote:
> >> Ok, now I have changed to UTF-8 with a BOM. And "auto-detect" even for Japanese should work.
> >
> > I suggest you remove the BOM. It's quite unnecessary with UTF8 as the
> > byte-order is fixed.
>
> Thank you for the comment. That was what I did at first. But without a BOM it looks like IE did could not recognize the page as UTF-8 even though the header specified the encoding.
>
> Now, with the BOM, it looks like IE is able to automatically recognize the encoding.
(As Jim says, the "BOM" (which it isn't really) has no normal
significance; but it _does_ prompt M$ systems to notice UTF-8. For
example, if you send a UTF-8 text file to M$ people, it helps to put
the "BOM" sequence at the front, or they phone up and say they can't
"open" the file.)
But before resorting to M$-kludges, look at what you are sending. If
you can run this command (cd temp first!):
wget --save-headers
http://www.doublet.jp/
It will dump the complete output from the server in a file called
index.html. You will then notice the following:
The first part is the http headers, including one that says
Content-Type: text/html
This does not specify utf-8. Then the html document starts with the
<head> (*not* the same as the _headers_), and the first line is:
<title>株式会社DOUBLET - あなたが必要とする言語の翻訳、ローカリゼーション、DTP、通訳を提供します。</title>
This is in utf-8, but occurs *before* the first thing in the file that
mentions utf-8, which is the *next* line:
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
Any system that does not default to utf-8 might have problems. So I'm
sure the following are good ideas:
o Put the <meta> tag charset specification first in the <head>
o Add the charset to the *header* sent by the server. Probably you can
simply change the default settings in .htaccess (assuming you're using
Apache)
I don't think the "BOM" is really a good idea -- it might possibly
upset standards-compliant systems that assume that the first non-
whitespace characters should be the <doctype> tag, or else there isn't
one.
Brian Chandler