TB/TB-2007-03-PGCHARS

From Scalix Wiki
Jump to: navigation, search

Problem Description

There is a known issue that can occur when attempting to insert Unicode characters into the Platform database. This error occurs when UTF8 characters are used in a message, but the destination database’s character encoding does not contain the character or provide a suitable conversion. When this error occurs, it will create an entry similar to the following in the scalix-api.log file:

WARN [RestServlet.sendError:28] Sending error
M00005 full folder sync failed
Message:java.sql.BatchUpdateException: Batch entry 1,198 insert into message
values ...

If logging is enabled on the PostgreSQL server (logging is disabled by default on some Linux distributions), its logs will contain a corresponding entry similar to this:

ERROR: character 0xe28099 of encoding "UTF8" has no equivalent in "LATIN1"

This issue can result in slower loading times for SWA clients, and in some cases prevents users from being able to login into SWA or the Mobile client. More detailed information is available in bug 14282

Resolution

To correct this issue, the database must be recreated with Unicode character encoding.  Two scripts are provided to accomplish this:

Both scripts should be placed in the directory /opt/scalix-postgres/bin/ and should be executed as root. The scripts do not require any arguments. sxpsql-checkencoding will report the current character set encoding used by the Scalix database:

[root@test9]# /opt/scalix-postgres/bin/sxpsql-checkencoding
SQL_ASCII

If this is ‘UNICODE,’ all is well and it will not be necessary to run sxpsql-recreatedb. For all other character set encodings (e.g. SQL_ASCII, LATIN1), sxpsql-recreatedb should be run next. To recreate the database with Unicode character encoding, execute sxpsql-recreatedb. This will briefly stop the Scalix Tomcat service if it is running, recreate the Scalix database with the correct encoding, and restart Tomcat:

[root@test9]# /opt/scalix-postgres/bin/sxpsql-recreatedb<br>Stopping Tomcat service (test9): [ OK ]
DROP DATABASE
CREATE DATABASE
Starting Tomcat service (test9): [ OK ]

After the script has completed, the database contents will begin to rebuild with the new encoding.