You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2008-11-26 11:15:28

rayz0r
Member
Registered: 2008-11-04
Posts: 10

Mail ticket decoding problem

I am using glpi 0.71.2, php 5.1.6, mysql 4.1
Firstly mail gateway told me mbstring extension not installed and I found some functions
mb_list_encodings()  not supported by php4 so I upgraded to php5
the warning message has gone then.

Well after that I use outlook to send email with charset GB2312 (Chinese) to create the ticket.
then I found the ticket created by my mail was decoded as iso-8859-1

After that I checked inc/mailgate.class.php I found this

function decodeMimeString($mimeStr, $inputCharset='utf-8', $targetCharset='utf-8', $fallbackCharset='iso-8859-1') {
        if (function_exists('mb_list_encodings')&&function_exists('mb_convert_encoding')){
            $encodings=$this->mb_list_lowerencodings();
            $inputCharset=strtolower($inputCharset);
            $targetCharset=strtolower($targetCharset);
            $fallbackCharset=strtolower($fallbackCharset)

So I changed iso-8859-1 to cp936 and then euc-cn (which supported by mbstring)

function decodeMimeString($mimeStr, $inputCharset='utf-8', $targetCharset='utf-8', $fallbackCharset='cp936')

Now the title of the ticket in tracking section displays correctly.
But the mail body still coded as iso-8859-1

I cannot find why this happened, anyone?


GLPI 0.71.2, Apache 2.0.52, php 5.1.6, mysql 4.1.20

Offline

#2 2008-11-27 06:26:10

rayz0r
Member
Registered: 2008-11-04
Posts: 10

Re: Mail ticket decoding problem

BTW, the Chinese translation really sucks, I would like to make a proper version for you guys after I'm done with the initial setup


GLPI 0.71.2, Apache 2.0.52, php 5.1.6, mysql 4.1.20

Offline

#3 2008-11-27 08:15:17

rayz0r
Member
Registered: 2008-11-04
Posts: 10

Re: Mail ticket decoding problem

Problem resolved by modifying some codes:
$tkt['contents']= utf8_encoding($body);
to
$tkt['contents']= $this->decodeMimeString($body); //this will use the function DecodeMineString again. Otherwise all contents will be dealt as iso-8859-1

Hope this could help somebody

Last edited by rayz0r (2008-11-27 08:15:50)


GLPI 0.71.2, Apache 2.0.52, php 5.1.6, mysql 4.1.20

Offline

#4 2008-11-27 12:34:02

JMD
GLPI - Lead
Registered: 2004-09-13
Posts: 9,180
Website

Re: Mail ticket decoding problem

Thanks for the return. I move the thread in bug category.

For the translation, please asking for an access to the online translation tool  (cf website)


JMD / Jean-Mathieu Doléans - Glpi-project.org - Association Indepnet
Apportez votre pierre au  projet GLPI   : Soutenir

Offline

Board footer

Powered by FluxBB