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 2010-03-05 23:14:19

radist
Member
From: xUSSR
Registered: 2010-03-05
Posts: 1
Website

[mailgate] multiple recoding for CP1251 and KOI-8RU codepages

My configuration
Server side: WinNT/5.1sp3rus, Apache/2.2.9, PHP/5.2.6 (default charset cp1251), MySQL/5.0.45-community-nt (database codepage utf-8, collation utf8_unicode_ci)
Client side: Firefox/3.5.8, Thunderbird/3.0.2

Steps to reproduce the problem
1. Install glpi (using russian language) version 0.72.4.
2. Setup receiver with some ordinary POP3 mailbox.
3. Create plain-text mail with russian letters in both topic and body.
4. Specify Cyrillic charset 'Windows-1251' (i.e. cp1251) or 'KOI-8R' for message.
5. Send message to the mailbox specified in 2.
6. Get e-mail tickets from mailbox.
7. Navigate to the Assistance -> Tracking and open the newly created ticket.

Expected result
Exact mail body in description field.

Actual result
Broken text in description field (looks like utf-8 text in cp1251/koi-8r codepage)

Additional information
Seems like this issue should exhibit for e-mails in other non-latin1 codepages.

Source code investigation
Looks like the problem is related to the MailCollect class from inc/mailgate.class.php: method get_part (called from getBody method) recodes the message body to utf8 and then utf-8 encoded message body is recoded in  buildTicket method by the following lines (inc/mailgate.class.php, line 319):

        if (!empty($this->charset)&&function_exists('mb_convert_encoding')){
            $body=mb_convert_encoding($body, 'utf-8',$this->charset);
        }

Commenting out this lines fixes the problem.


don't speak French

Offline

Board footer

Powered by FluxBB