There are many problems with UTF-8-encoded websites. I started to change CODEPAGE = "936" to CODEPAGE = "65001" and change charset = gb2312 to charset = UTF-8, but it is still garbled, as long as the script is used or garbled, the problem is finally found, that is, when the script is output, it must be output in UTF-8 encoding. Just add one sentence.
Program code
<% Response. Charset = "UTF-8" %>
Program code
First of all, of course, the page itself with UTF-8 encoding, the default encoding in DW new page as "Unicode (UTF-8 )"
<% @ LANGUAGE = "VBSCRIPT" CODEPAGE = "65001" %>
② CODEPAGE = "65001" tells the server page to use UTF-8-encoded
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
③ Charset = UTF-8 tells the browser that the page uses UTF-8 Encoding
</Head>
<Body>
<% Response. Charset = "UTF-8" %>
④ The server output code is UTF-8.
</Body>
</Html>
I thought it would be okay. After refreshing the page, it would be garbled again, or when I browsed other gb2312 pages, it would be garbled again. I had to go to Google again.
Take a look at the text below, and you will know that after I add this, the top of the program
Program code
<% Session. CodePage = 65001%>
Program code
<% @ Codepage = 936%> Simplified Chinese
<% @ Codepage = 950%> traditional Chinese
<% @ Codepage = 65001%> UTF-8
Codepage specifies the encoding used by IIS to read passed strings (such as form submission and address bar transfer ).
The cause of garbled characters is that the module encoding is different when the website is to be integrated.
Do not convert the encoding of the webpage in any module to UTF-8, or GB2312 to GB2312.
So I added the following code to the conn. asp file of the GB2312 module:
<% @ LANGUAGE = "VBSCRIPT" CODEPAGE = "936" %>
<% Session. CodePage = 936%>
Everything is OK!
Also in the package file of the Utf-8 module (such as conn. asp, but note that conn. asp must be at the beginning of the first line of CALL) add
Program code
<% @ LANGUAGE = "VBSCRIPT" CODEPAGE = "65001" %>
<% Session. CodePage = 65001%>