Confluence 2.6 : Configuring Database Character Encoding
This page last changed on Mar 15, 2007 by don.willis@atlassian.com.
The database used with Confluence should be configured to use the same character encoding as Confluence. The recommended encoding is Unicode UTF-8. There are two places where character encoding may need to be configured:
The configuration details for each type of database are different. Some examples are below. JDBC connection settingsMySQLAppend "useUnicode=true to your JDBC URL: jdbc:mysql://hostname:port/database?autoReconnect=true&useUnicode=true Creating a UTF-8 databaseMySQLCREATE DATABASE confluence CHARACTER SET utf8 COLLATE utf8_general_ci; Use the status command to obtain database character encoding information. For more information see the MySQL documentation. PostgreSQLCREATE DATABASE confluence WITH ENCODING 'UNICODE'; Or from the command-line: $ createdb -E UNICODE confluence For more information see the PostgreSQL documentation. For PostgreSQL running under WindowsPlease note that international characters sets are only fully supported and functional when using PostgreSQL 8.1 and above under Microsoft Windows. For PostgreSQL running under Linux
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. Updating existing database to UTF-8MySQL database with existing data
This example shows how to change your database from latin1 to utf8.
In MySQL:
Finally, reimport the UTF-8 text file:
To support large imports, the parameter '--max_allowed_packet=64M' used above sets the maximum size of an SQL statement to be very large. In some circumstances, you may need to increase it further, especially if attachments are stored in the database. Testing database encodingSee Troubleshooting Character Encodings for a number of tests you can run to ensure your database encoding is correct. Related Documentation |
![]() |
Document generated by Confluence on Oct 10, 2007 18:49 |