Re: Why my browser always chooses UTF-8 charset?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Teng Wang wrote:
Although I have included charset (GB2312) information in my
html/php files.


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

And my browser has "Auto-select" settings.
How to make the browser select charset correctly,

W3C:

Conforming user agents must observe the following priorities when determining a document's character encoding (from highest priority to lowest):

1. An HTTP "charset" parameter in a "Content-Type" field.
2. A META declaration with "http-equiv" set to "Content-Type" and a value set for "charset".
3. The charset attribute set on an element that designates an external resource.


In addition to this list of priorities, the user agent may use heuristics and user settings. For example, many user agents use a heuristic to distinguish the various encodings used for Japanese text. Also, user agents typically have a user-definable, local default character encoding which they apply in the absence of other indicators.

========
So the solution should be:

header('Content-Type: text/html; charset=gb2312');

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux