Iv’e configured mysql 5.0 to store utf8 characters.I checked it with following queries :
SELECT character_set_name FROM information_schema.`COLUMNS` C
WHERE table_schema = "oprdb"
AND table_name = "rtable"
AND column_name = "rtxt";
the result is utf8
SHOW FULL COLUMNS FROM rtable
this shows me collation as utf8_general_ci
show variables like "character_set_database";
show variables like "collation_database";
this too shows utf8 in result
it seems that mysql is configured correctly.
i am getting text from an html page where user types text in a textfield and i submit that text to servlet using jquery post.
My html page has this on top–
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
i also added this into my form —
enctype="text/plain;charset=UTF-8"
In my servlet the first line in doPost is
request.setCharacterEncoding("UTF-8");
and after that i just save that text in database.But the problem is that,i can’t store this kind of text
Hiki iaʻu ke ʻai i ke aniani; ʻaʻole nō lā au e ʻeha.
Я магу есці шкло, яно мне не шкодзіц
is their anything i am missing?
EDIT:
This is my datasource configuration..
<Resource auth = "Container"
driverClassName = "com.mysql.jdbc.Driver"
factory = "org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
initialSize = "10"
logAbandoned = "true"
maxActive = "50"
maxIdle = "2"
maxWait = "10000"
name = "jdbc/oprdb"
username = "root"
password = "123456"
removeAbandoned = "true"
removeAbandonedTimeout = "60"
type = "javax.sql.DataSource"
url = "jdbc:mysql://localhost:3306/oprdb" />
Update your url to
jdbc:mysql://localhost:3306/oprdb?useUnicode=true&characterEncoding=UTF-8for utf-8 support