1. Connecting the database STRING URL = "JDBC: mysql: // localhost: 3306 / test /? User = root & useunicode = true & characterencoding = GBK"; // Note that GBK
2. When writing to the database: used to convert the encoding
Public string ex_chinese (string str) {Try {string temp = new string (Str.getbytes ("ISO8859-1"), "GBK"); Return Temp;} Catch (Exception E) {} Return "NULL";}
3. Each JSP page plus
<% @ Page ContentType = "Text / HTML; Charset = GBK" Language = "Java" Import = "java.sql. *" ErrorPage = ""%>