Encoding Problem Due to Unsupported Database Configuration

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Symptoms

  1. Foreign characters are rendered as "????????" once the page is saved.

    (Auto-migrated image: description temporarily unavailable)
  2. Encoding test fails at database round-trip and it displays error "The file name has been mangled".

    (Auto-migrated image: description temporarily unavailable)

Diagnosis

  1. Perform encoding test via the following URL.

    1 http://<host address>:<port>/admin/encodingtest.action
  2. 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.

    1 SHOW VARIABLES LIKE 'character_set%';

    Sample

    1 2 3 4 5 6 7 8 9 10 11 12 +--------------------------+--------------------------------------------------------+ | 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.

    1 SHOW VARIABLES LIKE 'collation%';

    Sample

    1 2 3 4 5 6 7 +----------------------+-----------------+ | 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 and characterEncoding=utf8 flags.

Cause

The characters are tampered during the conversion between Confluence and database. The characters are changed to "?????" after the page is saved (database round-trip).

Solution

Resolution

  1. Ensure that the database is setup as described in Database Configuration documentations.

  2. If your collation_connection is neither utf8_bin nor utf8_general_ci, please add the following parameters to your MySQL database my.cnf (Unix) or my.ini (Windows) file under mysqld section.

    1 2 3 4 5 6 7 [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.

    1 skip-character-set-client-handshake
  3. Restart MySQL database.

  4. Re-execute the SQL queries mentioned in the Diagnosis Section to ensure the recent added parameter takes effects.

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.