I used to encounter garbled characters in ASP before. I only remember that I set the encoding method and how I did it. Now I have an episode about dealing with ASP, I accidentally encountered a garbled problem. I will summarize the problem this time and hope that ASP will not be used in the future.
- <Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"> If the page contains Chinese characters, this sentence cannot be saved, put it in
- <% @ Language = "VBScript" codePage = "936" %> if all the data obtained from the database is garbled, add this sentence. 936 indicates gb2312 encoding, put it in the first line of each page, remember that each page is not every ASP file.
- If garbled characters are still displayed after the preceding settings, or a page execution error occurs (for example, if a string does not end with a mark, it means that the double quotation marks are ended: ", the string is Chinese, but the file is opened with double quotation marks, in addition, adding a space before the last double quotation mark of the string can be executed successfully, but there are still garbled characters), indicating the encoding of some files (both file storage encoding, many editors use UTF-8 by default) Incorrect. Open the error page and Its referenced files to see its page encoding. Here we take the Dreamweaver CS3 editor as an example, in the "modify" menu "Page attribute", click "title/encoding" to check whether the encoding item is "UTF-8". If yes, change it to "gb2312" and save it, check all possible files.
I have encountered many garbled issues this time. Only the above three problems can be solved.