The JSP page uses the following three statements to ensure GBK encoding.
<% @ Page session = "true" %>
<% @ Page contenttype = "text/html; charset = GBK" %>
<% @ Page pageencoding = "GBK" %>
<% Request. setcharacterencoding ("GBK"); %>
Use the following statement to connect to a database:
String sconnstr = "JDBC: mysql: // localhost: 3306/test? User = Michael & Password = 123456 & useunicode = true & characterencoding = GBK ";
AndMySQLThe contents of my. ini are as follows:
Basedir = D:/MySQL
# Bind-address = 127.0.0.1
Datadir = D:/MySQL-data/Data
Default_character_set = GBK
# Language = D:/MySQL/share/your language directory
# Slow query log # =
# Tmpdir # =
# Port = 3306
# Set-variable = key_buffer = 16 m
[Winmysqladmin]
Server = D: // MySQL/bin/mysqld-nt.exe
User = Michael
Password = 123
[Client]
Default_character_set = GBK
The parameters passed between the read JSP pages are displayed normally on the page.
After data is inserted under the doscommand line, the display is normal.
one of the insert statements is as follows:
string strsql = "insert into chatreg (username, password, email, homepage)
values ("" + regname + "", "" + regpassword + "", "" + regemail + "", "" + reghomepage + "")";
reg.exe cutequery (strsql );