Confluence 2.9 のサポートは終了しています。
ドキュメントの最新バージョンを確認してください。
The database used with Confluence should be configured to use the same character encoding as Confluence. The recommended encoding is Unicode UTF-8.
文字エンコードの設定が必要になると考えられる場所が2つあります。
- データベースの作成時
- データベースへの接続時 (JDBC 接続 URL またはプロパティ)
データベースの各タイプの設定詳細は異なります。いくつかの例を以下に示します。
JDBC 接続設定
MySQL
"useUnicode=true" を JDBC URL に追加します。
jdbc:mysql://hostname:port/database?autoReconnect=true&useUnicode=true&characterEncoding=utf8
UTF-8 データベースの作成
MySQL
CREATE DATABASE confluence CHARACTER SET utf8 COLLATE utf8_bin;
Use the status
command to verify database character encoding information.
For more information see the MySQL documentation.
PostgreSQL
CREATE DATABASE confluence WITH ENCODING 'UNICODE';
またはコマンドラインから
$ createdb -E UNICODE confluence
詳細は、PostgreSQL ドキュメントを参照してください。
Windows で稼働する PostgreSQL
国際文字セットは、Microsoft Windows で PostgreSQL 8.1 以上を使用している場合にのみ完全にサポートされ、機能するので注意が必要です。
Linux で稼働する PostgreSQL
データベース内の国際文字が適切に処理されるように、次のことを必ず確認してください。
When PostgreSQL creates an initial database cluster, it sets certain important configuration options based on the host enviroment. The command responsible for creating the PostgreSQL environment initdb
will check environment variables such as LC_CTYPE
and LC_COLLATE
(or the more general LC_ALL
) for settings to use as database defaults related to international string handling. As such it is important to make sure that your PostgreSQL environment is configured correctly before you install Confluence.
To do this, connect to your PostgreSQL instance using pgsql
and issue the following command:
SHOW LC_CTYPE;
If LC_CTYPE is set to either "C" or "POSIX" then certain string functions such as converting to and from upper and lower case will not work correctly with international characters. Correct settings for this value take the form <LOCALE>.<ENCODING>
(en_AU.UTF8
for example).
If your LC_CTYPE is incorrect please check the PostgreSQL documentation for information on configuring database localisation. It is not easy to change these settings with a database that already contains data.
既存のデータベースを UTF-8 に更新する
既存のデータが含まれる MySQL データベース
以降の変更に進む前に、データベースをバックアップしてください。
This example shows how to change your database from latin1 to utf8.
- Dump the database to a text file using mysqldump tool from the command-line :
mysqldump -p --default_character-set=latin1 -u <username> --skip-set-charset confluence > confluence_database.sql
- Open the SQL file in a text editor and change all character sets from 'latin1' to 'utf8'
cp confluence_database.sql confluence_utf8.sql
- Encode all the latin1 characters as UTF-8:
recode latin1..utf8 confluence_utf8.sql
(Recode utility available from http://directory.fsf.org/recode.html)
MySQL の場合:
DROP DATABASE confluence;
CREATE DATABASE confluence CHARACTER SET utf8 COLLATE utf8_general_ci;
Finally, reimport the UTF-8 text file:
mysql -p --default-character-set=utf8 --max_allowed_packet=64M confluence < /home/confluence/confluence_utf8.sql
大容量のインポートをサポートするために、上記で使用されたパラメーター '--max_allowed_packet=64M' が SQL 文の最大サイズを非常に大きな値に設定します。状況によっては、特に、添付ファイルがデータベースに保存されている場合など、さらに値を大きくする必要がある場合もあります。
データベースエンコードをテストする
データベースエンコードが正しく動作することを確認するために実行できる多くのテストについては、「文字エンコードのトラブルシューティング」を参照してください。