asp+mysql+utf8 web pages appear disorderly code solution

  • 2020-06-12 10:48:13
  • OfStack

MYSQL is the code for UTF8, but no matter how many definitions of UTF8 are added to the web page, the results will still be a small grid, and LIKE Chinese in SQL statements can not be queried. Instead, it is defined as gb2312 and appears completely normal.

conn. asp at the top of the page
 
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> 
<%Session.CodePage=936%> 
Set conn = CreateObject("ADODB.Connection") 
 Join statement  DRIVER={MYSQL ODBC 3.51 Driver};database= ..................... CharSet=gb2312; 
conn.Execute "SET NAMES gb2312;" 

Web page
 
<meta http-equiv="Content-Type" content="text/html;charset=gb2312"> 

The program displays Chinese normally, LIKE '% Chinese %' in SQL statement is normal.

Related articles: