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

From: Date: Sun, 03 Oct 2004 23:46:37 +0000
Subject: Re: Why my browser always chooses UTF-8 charset?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-198562@lists.php.net to get a copy of this message
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');

« previous php.general (#198562) next »