utf8 文字を格納するように mysql 5.0 を構成しました。次のクエリで確認しました。
SELECT character_set_name FROM information_schema.`COLUMNS` C
WHERE table_schema = "oprdb"
AND table_name = "rtable"
AND column_name = "rtxt";
結果はutf8
SHOW FULL COLUMNS FROM rtable
これは私collation
を次のように示していますutf8_general_ci
show variables like "character_set_database";
show variables like "collation_database";
これもutf8
結果に表れる
mysqlが正しく構成されているようです。ユーザーがテキスト フィールドにテキストを入力する html ページからテキストを取得し、そのテキストを jquery post を使用してサーブレットに送信します。
私のhtmlページにはこれが一番上にあります--
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
これもフォームに追加しました-
enctype="text/plain;charset=UTF-8"
私のサーブレットでは、doPost の最初の行は
request.setCharacterEncoding("UTF-8");
その後、そのテキストをデータベースに保存するだけですが、問題は、この種のテキストを保存できないことです
Hiki iaʻu ke ʻai i ke aniani; ʻaʻole nō lā au e ʻeha.
Я магу есці шкло, яно мне не шкодзіц
私が見逃しているものはありますか?
編集:
これは私のデータソース構成です..
<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" />