When we browse or use UFT-8 format pages, there may always be some garbled or non-displayed problems. Download the analysis and solutions for some reasons on the browser client and server and use them on the Windows operating system. When IE is used as a browser. This problem often occurs: when browsing a webpage using UTF-8 encoding, the browser cannot automatically detect (that is, when it is not set to automatically select the encoding format) 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 />
This causes some pages containing Chinese UTF-8 encoding to produce blank output.
If you are using Mozilla, Mozilla browser, or Sarafi browser, 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 in the <head></head> tag of the web page file.
<meta http-equiv=Content-Type content=text/html; charset=UTF-8 />
Place before <title></title>.
----------------------------------------
=====================
Solving the problem of garbled UTF-8 web pages:
<%@codepage=65001%>
< http-equiv=Content-Type content=text/html; charset=UTF-8>
Not one less
In addition, the file must be saved in utf-8 format.
Also, the program cannot make mistakes, hehe
If there is a wrong program, it will be normal when you first open it, but it will be garbled after refreshing.
The errors mentioned here will not cause the entire page to not be displayed.
1.<%@codepage=65001%>
2. <http-equiv=Content-Type content=text/html; charset=UTF-8>
3. Session.CodePage = 65001
4. Save the file as UTF-8
Let me tell you, I have more experience in this, haha
2. <http-equiv=Content-Type content=text/html; charset=UTF-8>
=======================================
This is more important and more common. It determines which internal code the viewer's browser chooses to access your web page.
4. Save the file as UTF-8
If you use the Chinese input method and Chinese characters appear on the web page, this item is more important. Because the text we input using the ordinary input method is not in UTF format, it must be re-saved in UTF-8 format.
All Chinese characters read from the database are garbled.
=====================
1.<%@codepage=65001%>
If this happens, please add this sentence. In fact, the database has nothing to do with the internal code. The key is what internal code the ASP program uses to transmit your data. Adding this sentence will force ASP to use UTF to transmit data.
Try adding a line under <%@codepage=65001%>:
<%Session.CodePage=65001%>
The problem of utf-8 web pages not being displayed + utf-8 web pages being garbled can generally be solved.