Random Code Reporting a New Bug

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
datochan
Posts: 4
Joined: 11 Apr 2018, 03:06

Random Code Reporting a New Bug

Post by datochan »

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.
datochan
Posts: 4
Joined: 11 Apr 2018, 03:06

Re: Random Code Reporting a New Bug

Post by datochan »

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.
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Random Code Reporting a New Bug

Post by atrol »

PHP 7.2.x can't be recommend at the moment.
I recommend to use PHP 7.1.x instead of it.
Please use Search before posting and read the Manual
datochan
Posts: 4
Joined: 11 Apr 2018, 03:06

Re: Random Code Reporting a New Bug

Post by datochan »

Thanks, atrol. I will try PHP 7.1.x.
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Random Code Reporting a New Bug

Post by atrol »

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
Please use Search before posting and read the Manual
datochan
Posts: 4
Joined: 11 Apr 2018, 03:06

Re: Random Code Reporting a New Bug

Post by datochan »

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.
Post Reply