Application Error #401 [cyrillian Email]

This plugin allows you to report an issue in MantisBT by sending an email to a particular mail account

Moderators: Contributor, Developer

Application Error #401 [cyrillian Email]

Postby oboeck » Sep 13, 2011 8:15 am

Hello,

I hope you could help me to find a solution for my problem.

We installed the Plugin on a Mantis Version 1.2.3 and it runs smooth. It's some kind of windows server with an inetpub-folder (I don't have real access to this, because it's an customer).
The database has UTF-8 and in the plugin-setting is UTF-8 too.
Email Reporting Version is 0.8.2. and on the server runs PHP 5.2.14.

But at the time an email with cyrillian characters is collected from the postbox, the plugin crashes and throw this error Message.
The message is:

APPLICATION ERROR 0000401

Database query failed. Error received from database was #1366: Incorrect string value: '\x93junk...' for column 'description' at row 1 for the query: INSERT INTO mantis_bug_text_table
( description, steps_to_reproduce, additional_information) VALUES ( ?,?,?).
Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.


Previous non-fatal errors occurred. Page content follow.
[...
SYSTEM WARNING: mb_convert_encoding() [..]: Unable to detect the character encoding
....]

I don't know if this here relates to my problem, but there "SL-Gundam (Manager)" fixed the problem via mail.
http://www.mantisbt.org/bugs/view.php?id=4286#c25072 (post 25072 to 25134)
http://www.mantisbt.org/bugs/view.php?id=11770 (this is the same just seperatly)

Kind Regards
oboeck
oboeck
 
Posts: 3
Joined: Sep 13, 2011 6:22 am

Re: Application Error #401 [cyrillian Email]

Postby SL-Gundam » Sep 13, 2011 6:20 pm

Referenced issues are not related to your problem i'm afraid

Your problem is the following. The email itself does not specify its character encoding or it could not be found by the EmailReporting plugin

If the character encoding is not found it falls back on "auto". Which is basically means ASCII,JIS,UTF-8,EUC-JP,SJIS (http://www.php.net/manual/en/mbstring.s ... odings.php)

Apparently this does not include cyrillian.

Now there are 2 options.
1. Find out why the character encoding is missing in your emails. Microsoft Outlook for example has the option to define it here for new emails: Tools -> Options -> Mail Format -> International options -> Encoding options
2. Wait for the release of EmailReporting 0.9.0 (which requires MantisBT 1.2.6+). I'm going to try to improve the detection of the character sets in that version
SL-Gundam
 
Posts: 187
Joined: Jul 06, 2011 9:17 am

Re: Application Error #401 [cyrillian Email]

Postby oboeck » Sep 14, 2011 1:57 am

Hello SL-Gundam,

big thanks for that fast response.

I will try it with the encoding in the mailsettings from outlook and give a feedback afterwards.
But it is a bit strange too that the fallback "utf-8" or "windows-1250" as it says on the list from the mbstring apparently doesn't support cyrillic characters? I though cyrillic is part of UTF-8 or windows-1251.

Kind regards
oboeck
oboeck
 
Posts: 3
Joined: Sep 13, 2011 6:22 am

Re: Application Error #401 [cyrillian Email]

Postby SL-Gundam » Sep 14, 2011 10:30 am

the fallback "auto" is only the short list i posted, not all the character sets in the link i gave. Thats the thing that needs to be fixed in 0.9.0
SL-Gundam
 
Posts: 187
Joined: Jul 06, 2011 9:17 am

Re: Application Error #401 [cyrillian Email]

Postby oboeck » Sep 19, 2011 4:42 am

Hello SL-Gundam,

now I gotcha!
I tried to set the enconding into outlook but it's not possible in my version. And the customer said, that the mail come from the different countries from his customers and he couldn't really check what encodings they use.
So we decided to wait for the next release. Could you please expand the "auto" as you already suggested? We need this really, to get the thing runnig right.

What do you thing when the next release is coming??

Thank you for all
Kind regards
oboeck
oboeck
 
Posts: 3
Joined: Sep 13, 2011 6:22 am

Re: Application Error #401 [cyrillian Email]

Postby SL-Gundam » Sep 19, 2011 11:05 am

0.9.0 is still in development. I'm not really sure when it will be released as i've still got a pretty big todo list before a stable release is possible.

If you are in a hurry then i can post here ones the changes have been committed into git and then you can get the 0.9.0-DEV. But since that is a development release it could contain any number of bugs
SL-Gundam
 
Posts: 187
Joined: Jul 06, 2011 9:17 am

Re: Application Error #401 [cyrillian Email]

Postby indancesky » Aug 01, 2012 9:23 pm

Apparently this does not include cyrillian.

Now there are 2 options.
1. Find out why the character encoding is missing in your emails. Microsoft Outlook for example has the option to define it here for new emails: Tools -> Options -> Mail Format -> International options -> Encoding options
2. Wait for the release of EmailReporting 0.9.0 (which requires MantisBT 1.2.6+). I'm going to try to improve the detection of the character sets in that version
.
Rc Helicopters Reviews|Rc Helicopter
indancesky
 
Posts: 1
Joined: Aug 01, 2012 9:10 pm

Re: Application Error #401 [cyrillian Email]

Postby athirat » Nov 02, 2012 3:27 am

hi
i am running Mantis 1.2.11 with Emailreporting 0.9.0-dev. I found the same problem when trying to get email which is not standard encoding. After investigate, the problem will happen when emailreporting try to convert email with "TIS-620" or "windows-874". those charset are using for Thai encoding. Unfortunately, both charset are not support by function mb_convert_encoding as mentioned at http://www.php.net/manual/en/mbstring.supported-encodings.php

Cause of problem & solution:

1. in original Parser.php, it will check whether the charset in mail heading is support by function:mb_convert_encoding or not, if not it will set charset to 'auto' and leave function:mb_convert_encoding handle the conversion which end up with error.

Solution: i have decided to to use charset in email header for conversion instead.

Original function :
private function setCharset( $charset )
{
if ( extension_loaded( 'mbstring' ) && $this->_charset === 'auto' )
{
$t_arraysearch_result = array_search( strtolower( $charset ), $this->_mb_list_encodings, TRUE );
$this->_charset = ( ( $t_arraysearch_result !== FALSE ) ? $t_arraysearch_result : 'auto' );
}
}

Modified function:
private function setCharset( $charset )
{
if ( extension_loaded( 'mbstring' ) && $this->_charset === 'auto' )
{
$t_arraysearch_result = array_search( strtolower( $charset ), $this->_mb_list_encodings, TRUE );
// $this->_charset = ( ( $t_arraysearch_result !== FALSE ) ? $t_arraysearch_result : 'auto' );
$this->_charset = ( ( $t_arraysearch_result !== FALSE ) ? $t_arraysearch_result : $charset );

}
}

2. as mentioned, the function:mb_convert_encoding still not support Thai encode but function: iconv does. so i have change function:process_encodeing as below

Original:
private function process_encoding( $encode )
{
if ( extension_loaded( 'mbstring' ) && $this->_encoding !== $this->_charset )
{
$encode = mb_convert_encoding( $encode, $this->_encoding, $this->_charset );
}

return( $encode );
}

Modified :
private function process_encoding( $encode )
{
if ( extension_loaded( 'mbstring' ) && $this->_encoding !== $this->_charset )
{

//$encode = mb_convert_encoding( $encode, $this->_encoding, $this->_charset );
$encode = iconv( $this->_charset, $this->_encoding, $encode );
}

return( $encode );
}

after the changes, Mantis now can handle both encode and show proper text in ticket.

I hope this can help someone who has problem like me.

Cheers,
Athirat
athirat
 
Posts: 1
Joined: Nov 02, 2012 3:03 am

Re: Application Error #401 [cyrillian Email]

Postby SL-Gundam » Nov 02, 2012 6:12 pm

Thanks i will see about integrating a choice to use iconv or mb_string and maybe integrate part of your code
SL-Gundam
 
Posts: 187
Joined: Jul 06, 2011 9:17 am


Return to EmailReporting

Who is online

Users browsing this forum: No registered users and 1 guest