kimaniwamwangi / php-mime-mail-parser

Automatically exported from code.google.com/p/php-mime-mail-parser
0 stars 0 forks source link

Wrong (encoded) attachment file name for at least windows-1251 encoding #28

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to save attachments (like explained here) 
http://code.google.com/p/php-mime-mail-parser/ form the attached file
2. Filenames extracted by the $Parser->getAttachments() are encoded like
=?windows-1251?B?0e+z4uC6IODt8eDs4ev8IF9fxO2z7/D/7e736uBfXyAo9fPk7ubts+kg?= 
=?windows-1251?B?6uXws+Lt6Oogwi7K7vH+6ikuLkpQRw==?=

3. To convert them to real filenames I used such a trick
After the code in the example:
    $filename = $attachment->filename;
I added:
    $filenamearr = imap_mime_header_decode($filename);
    $title = '';
    foreach ($filenamearr as $element) {
        $title .= iconv($element->charset,'UTF-8',$element->text);
    }
    $filename = $title;

This saves the filenames as expected.

What version of the product are you using? 
MimeMailParser.class.php    11.6 KB r21 Oct 22, 2010    eugene.emmett.wood
attachment.class.php    2.9 KB  r17 Aug 12, 2010    bucabay
Please provide any additional information below.

On what operating system?
Opensuse 12.1 (Linux)

Original issue reported on code.google.com by arygroup@gmail.com on 25 Jan 2012 at 5:55

Attachments: