Describe the issue or problem
After upgrading to OJS 3.4.0-8, we were not able to save changes in pages that contain special characters like ( and :
our site is using Arabic and English languages. The collation for our database after upgrading is “utf8mb3_general_ci” and PHP version is 8.1.
I used to Chatgpt to solve the problem and it suggest to change the collation to utf8mb4_unicode_ci and modify the Config file by changing:
connection_charset = utf8mb4
database_charset = utf8mb4
One important thing to keep in mind, is to backup your database before making any changes. That will allow you to try it, and revert back, in case it becomes problematic.
Thank you @rcgillis for your quick response. I went through the post that you suggest and tried to modify the connection_charset to utf8mb3 but nothing changed. I attached a screenshot for our database specification. I hope @asmecher can help us to confirm if we need to change the database collation or we should do something else.
OJS 3.4.0-8
PHP 8.1
For Example: If I write the word “system”, I can save the changes in the page. However, If write the word “system(” or “system:”, I can not save the changes and I need to reload the page again. The problem is with the parenthesis and colon.
Before you get too deeply into the database character set configuration, can you describe what happens when you try to save a page that contains a ( or a :? These are not multibyte UTF-8 characters, so something else might be happening.
Regards,
Alec Smecher
Public Knowledge Project Team
Thank you so much @asmecher for your advice and help.
Here is the steps to produce that error
1- Settings → Website → Setup → Navigation
2- Select any custom page to edit → write "systme( " → click save
3- It will not update the changes and it will stuck forever
Check your browser’s web developer tools in the Network tab to see what the response code is when you try to save the form. I suspect you’ll see a 4xx code. My best guess is that your server has a security toolset like mod_security that mistakenly thinks that the ( is an attempt to attack the server, and is preventing the form from being saved.
Parentheses aren’t UTF-8 multibyte characters, so I don’t think the UTF8 configuration is part of the problem.
Regards,
Alec Smecher
Public Knowledge Project Team
@asmecher
Thank you for the suggestion. You were right, it was mod_security preventing the from being saved. However the tricky part is that no indication of the block within mod_security hit list which usually log any action or security measures taken by the plugin especially those that triggers 4xx code. Instead, the block was mentioned in Apache log file. The entry included the mod_security rule ID in which I had to disable. After I disabled the rule ID, I could now save the form normally without issue.
Regards,
-Salam