I installed Mantis 2.13.1 on IIS Windows 2012. I set everything to UTF-8 since my environment is traditional Chinese. Everything seemed fine and I could see traditional Chinese everywhere in Mantis. However, every time when I submit a new bug, the Chinese text input were not saved correctly and resulted in random code on the view page. The weird thing is once I updated the bug, replaced the random code with Chinese and saved the bug, the random codes were gone and it displayed correctly.
I am guessing somewhere in the form data gathering or submission has an issue since I saw both random code and Chinese characters saved in the database for the bug. Could someone please help me? Thanks.
Random Code Reporting a New Bug
Moderators: Developer, Contributor
Re: Random Code Reporting a New Bug
Some more information:
PHP version: 7.2.4
ADOdb version: 5.20.12
Database Server: MySQL V5.7
I upgraded ADOdb version to 5.20.12 since the deprecated each() function used in the ADOdb came with Mantis V2.13.1. The same behavior was observed with Mantis V2.12.0 using the same PHP, ADOdb, and MySQL.
PHP version: 7.2.4
ADOdb version: 5.20.12
Database Server: MySQL V5.7
I upgraded ADOdb version to 5.20.12 since the deprecated each() function used in the ADOdb came with Mantis V2.13.1. The same behavior was observed with Mantis V2.12.0 using the same PHP, ADOdb, and MySQL.
Re: Random Code Reporting a New Bug
Thanks, atrol. I will try PHP 7.1.x.
Re: Random Code Reporting a New Bug
I am not experienced in what "traditional Chinese" exactly means.
Are there 4-byte UTF-8 characters in it?
If so, I would expect general problems, as we support just 3-byte UTF-8 at the moment and truncate 4-byte characters, see https://www.mantisbt.org/bugs/view.php?id=20431
Are there 4-byte UTF-8 characters in it?
If so, I would expect general problems, as we support just 3-byte UTF-8 at the moment and truncate 4-byte characters, see https://www.mantisbt.org/bugs/view.php?id=20431
Re: Random Code Reporting a New Bug
After running some tests and looking into the code, I believe it is the <?php echo $t_form_encoding; ?> snippet in the file bug_report_page.php caused the issue. The php snippet resulted in "enctype="multipart/form-data" in the html form and messed up the whole html meta tag utf8 charset encoding. The issue emerged wherever there is file attachment operation. I did the following to quick-fix the issue and it seemed work for me:
1. In bug_report.php and bugnote_add.php, utf8 decode the strings of all gpc_get_string() calls
2. In the two files, decode all the attachment file names
I wonder this may not be just an issue with traditional Chinese, but also other unicode characters too.
1. In bug_report.php and bugnote_add.php, utf8 decode the strings of all gpc_get_string() calls
2. In the two files, decode all the attachment file names
I wonder this may not be just an issue with traditional Chinese, but also other unicode characters too.