The following three statements are used on the jsp (preferred for SUN Enterprise Applications) page 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 (the best combination with PHP): // localhost: 3306/test? User = michael & password = 123456 & useUnicode = true & characterEncoding = gbk ";
In addition, the content of my. ini in MySQL (the best combination with PHP) is as follows:
Basedir = D:/MySQL (the best combination with PHP)
# Bind-address = 127.0.0.1
Datadir = D:/MySQL (the best combination with PHP)-data/data
Default_character_set = gbk
# Language = D:/MySQL (the best combination with PHP)/share/your language directory
# Slow query log # =
# Tmpdir # =
# Port = 3306
# Set-variable = key_buffer = 16 M
[WinMySQL (best combination with PHP) admin]
Server = D:/MySQL (the best combination with PHP)/bin/mysql(and php ))))))))d-nt.exe
User = michael
Password = 123
[Client]
Default_character_set = gbk
The parameters passed between read jsp (preferred for SUN Enterprise Applications) 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:
<Jsp (preferred for SUN Enterprise Applications): useBean id = "reg" scope = "page" class = "test. chatreg"/>
String strSQL = "insert into chatreg (username, password, email, homepage)
Values ("+ regName +", "+ regPassword +", "+ regEmail +", "+ regHomepage + ")";
Reg.exe cuteQuery (strSQL );