IE cannot automatically select UTF-8 encoding solution
Author:Eve Cole
Update Time:2009-06-20 16:51:40
When using IE as browser on Windows operating system. This problem often occurs: when browsing a webpage using UTF-8 encoding, the browser cannot automatically detect (that is, when the "automatic selection" encoding format is not set) the encoding used by the page. Even if the web page has declared the encoding format: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />, some pages containing Chinese UTF-8 encoding will be blank. output.
If you are using Mozilla, Mozilla Firefox, or Sarafi browsers, this will not cause this problem. This is because when IE parses webpage encoding, it prioritizes tags in HTML, and then information in HTTP headers; while the Mozilla series of browsers do just the opposite.
Because UTF-8 uses 3 bytes to represent a Chinese character, while ordinary GB2312 or BIG5 uses two. When the page is output, due to the above reasons, when the browser parses and outputs the content of <title></title>, if there are an odd number of full-width characters before </title>, IE treats UTF-8 as two bytes. When parsing, half a Chinese character appears. At this time, the half Chinese character will be combined with the < of </title> to form a garbled word, causing IE to be unable to read the <title> part and leaving the entire page empty. If you look at the source file at this time, you will find that the entire leaf surface has actually been output.
Therefore, the simplest solution is to define the characters <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" / in the <head></head> tag of the web page file. > before <title></title>.