Malformed UTF-8 characters, possibly incorrectly encoded error after OJS upgrade/migration

Malformed UTF-8 characters, possibly incorrectly encoded error after OJS upgrade/migration

Recently I was dealing with migration of Open Journal Systems (OJS) website that wasn’t upgraded for 14 years but they decided that now is the time to do it.

After the migration, the front-end was working smoothly, but on the backend when accessing the Submissions page the following error occurred:

08VuGPA 1024x728 - Malformed UTF-8 characters, possibly incorrectly encoded error after OJS upgrade/migration

And by inspecting the page I noticed the following JSON file was returning 500 error:

/index.php/eap/api/v1/_submissions?status=l&searchPhrase=&count=20&offset=0&_=1634820665911
xy3zFZd 1024x519 - Malformed UTF-8 characters, possibly incorrectly encoded error after OJS upgrade/migration

So when opening the link directly the following error message was shown:

Slim Application Error
Slim Application Error

When checking the error log at the same time the following error message stood out:

Malformed UTF-8 characters, possibly incorrectly encoded
Malformed UTF-8 characters, possibly incorrectly encoded

This explains why the JSON file was inaccessible, OJS failed to encode it, as it will turn out, this issue is related to the database characterset configuration which was different on the new server.

As Alec Smecher from the Public Knowledge Project Team stated on the forums, these defaults were written before the UTF-8 adoption was well established, and the problem is solved in newer versions of OJS.

xhy38Xl - Malformed UTF-8 characters, possibly incorrectly encoded error after OJS upgrade/migration

To set the characterset, edit the config.inc.php file and change these to the following:

  • client_charset = utf-8
  • connection_charset = utf8
  • database_charset = utf8

whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.