Encoding Problem Due to Unsupported Database Configuration
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
症状
- Foreign characters are rendered as "????????" once the page is saved.
- Encoding test fails at database round-trip and it displays error "The file name has been mangled".
診断
Perform encoding test via the following URL.
http://<host address>:<port>/admin/encodingtest.action
Execute the following SQL queries to check the database character set and collation system variables that apply to your connection.
• MySQL
1. Return the values of the character set variables.
SHOW VARIABLES LIKE 'character_set%';
サンプル
+--------------------------+--------------------------------------------------------+ | Variable_name | Value | +--------------------------+--------------------------------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/local/mysql-5.5.x/share/charsets/ | +--------------------------+--------------------------------------------------------+
2. Return the values of the collation system variables.
SHOW VARIABLES LIKE 'collation%';
サンプル
+----------------------+-----------------+ | Variable_name | Value | +----------------------+-----------------+ | collation_connection | utf8_bin | | collation_database | utf8_bin | | collation_server | utf8_bin | +----------------------+-----------------+
3. Ensure that the JDBC Connection URL includes
useUnicode=true
andcharacterEncoding=utf8
flags.
原因
The characters are tampered during the conversion between Confluence and database. The characters are changed to "?????" after the page is saved (database round-trip).
ソリューション
- Ensure that the database is setup as described in Database Configuration documentations.
If your
collation_connection
is neitherutf8_bin
norutf8_general_ci
, please add the following parameters to your MySQL databasemy.cnf
(Unix) ormy.ini
(Windows) file undermysqld
section.[mysqld] ... init_connect='SET collation_connection = utf8_bin; SET NAMES utf8;' character-set-server=utf8 collation-server=utf8_bin default-storage-engine=INNODB ...
You might need to add the following parameter as well if the above parameters do not take any effect. This parameter ignores the client handshake with the server and enforces UTF-8 on any database communications.
skip-character-set-client-handshake
Restart MySQL database.
Re-execute the SQL queries mentioned in the Diagnosis Section to ensure the recent added parameter takes effects.