Fixing sogo's 'incorrect string value' error

When trying to accept a calendar invitation from people at a particular domain, sogo threw an error:

ERROR: Incorrect string value: 'xF0x9Fx93xB6Tu...' for column `sogo`.`sogo_quick_appointment`.`c_description` at row 1

This prevented me from accepting their invitation and adding it to my calendar.

Someone else had a similar issue recently.

They referenced this bug ticket as a solution:

If you are using MySQL / MariaDB, you need to change the charset of the table set in OCSStoreURL.

    Set charset_set to utf8mb4
    Set collation to utf8mb4_bin

SQL (where sogo_store is the name of your table) :

`ALTER TABLE sogo_store CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;`
`ALTER TABLE sogo_store MODIFY c_content MEDIUMTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;`

Update: it turns out that utf8mb4_bin is the wrong choice; use utf8mb4_general_ci instead.

Now, in my case, the table was not sogo_store, but sogo_quick_appointment. And I did not have c_content, but the error related to c_description, so I changed it to that, but I’m not sure it had any effect after the first command. (I could be wrong.)

I tried restarting mariadb and sogo, but this had no effect. Fortunately, rebooting the server did.

Fixing the logrotate issue

While looking into this, I noticed that the log file, /var/log/sogo/sogo.log was far too big - 1.4GB! So logrotate hadn’t been doing its job for a while.

I did a dry run, with logrotate -d /etc/logrotate.d/sogo, and it indicated that the permissions on /var/log/sogo were set too permissively. I chmod’d it to 700, and ran it again. It worked.