I believe many ASP programmers have encountered this problem. When testing on the local machine and interacting with the database, Chinese characters in the database will become garbled and not English. At the beginning, my solution was to create a virtual directory for the site. However, this is only a solution to the problem, and the problem will occur at any time, when we enjoy the fun of programming, we certainly cannot tolerate such a thing to disturb ~~~, By searching for the cause on the Internet, we finally found the fundamental solution.
I am not saying that Chinese characters may contain garbled characters, but English letters may not? First, we should guess whether the encoding is correct! The default internal encoding of ASP is Unicode. When the page is not specified, garbled characters may occur sometimes (why is it strange sometimes? I hope to explain it in the comment bar ), the solution is:Add <% @ codePage = 936%> In The Connection database Conn. asp file,You can display Chinese characters normally.
PS:
<% @ CodePage = 936%> Simplified Chinese
<% @ CodePage = 950%> traditional Chinese
<% @ CodePage = 65001%> UTF-8797000024
CodePage specifies the encoding used by IIS to read passed strings (such as form submission and address bar transfer ).
It also specifies the encoding for converting all text variables from Unicode,
It also specifies the Unicode conversion encoding of the data retrieved from the database.