FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=18876&edit=1

ID: 18876
Updated by: alan@akbkhome.com
Reported By: pear at dlopez dot com
Summary: getting attachment filename in the desired charset
Status: Closed
Type: Feature/Change Request
Package: Mail_mimeDecode
Operating System: linux
Package Version: SVN
PHP Version: 5.3.8
Assigned To: alan_k
Roadmap Versions:
New Comment:

Thanks, well spotted, should be fixed in svn now.

Regards
Alan


Previous Comments:
------------------------------------------------------------------------

[2011-09-27 12:06:36] dlopez

Holy cow, you're a superhero. I thought this feature request would be
on a back-burner (or perhaps had some simple workaround that wasn't
clear to me). Kudos to you.

Preliminary testing with KOI8 content (and with decode_headers=false)
looks good, with two notes:

1) The second argument to _decodeHeaders appears to be a misspelling of
$default_charset. It's not broken though because you misspelled it the
same way in both places.

2) For greater robustness you might want to check if iconv fails and
returns false. For example, if the charset passed via decode_headers is
invalid or not supported (I set it to 'foobar' to test), mimeDecode now
returns an empty string, which might catch people off-guard. If iconv
returns false you may want to leave the value either undecoded or else
do the straight decoding as was done prior to this patch. I suppose the
latter choice is more backward compatible.

------------------------------------------------------------------------

[2011-09-27 10:20:41] alan_k

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: alan_k
This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on pear.php.net
by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

Can you test the changed code.

http://svn.php.net/viewvc/pear/packages/Mail_Mime/trunk/mimeDecode.php?
r1=317378&r2=317377&pathrev=317378&view=patch

------------------------------------------------------------------------

[2011-09-27 10:02:25] alan_k

looks like it should be optional (so as not to break BC) - (however I
guess it is the recommended setting..)

------------------------------------------------------------------------

[2011-09-27 09:59:04] dlopez

One more clarification: I understand that you can set
decode_headers=false so that you can do the decoding yourself... but
then what's the point to ever setting decode_headers=true if you can't
trust that the return value will be in an expected charset? Wouldn't it
make more sense if decode_headers was a charset string that
_decodeHeader() would use to iconv() the output? And then put in a case
whereby if decode_headers=null, then it would skip any decoding (and
conversion)?

------------------------------------------------------------------------

[2011-09-26 21:16:56] dlopez

My bad--the iconv needs to apply to both B and Q cases, so the iconv
call should be on line 747 right before the str_replace.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://pear.php.net/bugs/bug.php?id=18876

Search Discussions

  • Pear at Oct 3, 2011 at 4:26 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=18876&edit=1

    ID: 18876
    Comment by: pear@dlopez.com
    Reported By: pear at dlopez dot com
    Summary: getting attachment filename in the desired charset
    Status: Closed
    Type: Feature/Change Request
    Package: Mail_mimeDecode
    Operating System: linux
    Package Version: SVN
    PHP Version: 5.3.8
    Assigned To: alan_k
    Roadmap Versions:
    New Comment:

    Sorry to continue the thread... was there a reason you check the return
    value of the iconv call after the loop, but not the one inside the loop?
    I would think it should be in there as well...


    Previous Comments:
    ------------------------------------------------------------------------

    [2011-10-03 07:48:24] alan_k

    Thanks, well spotted, should be fixed in svn now.

    Regards
    Alan

    ------------------------------------------------------------------------

    [2011-09-27 12:06:36] dlopez

    Holy cow, you're a superhero. I thought this feature request would be
    on a back-burner (or perhaps had some simple workaround that wasn't
    clear to me). Kudos to you.

    Preliminary testing with KOI8 content (and with decode_headers=false)
    looks good, with two notes:

    1) The second argument to _decodeHeaders appears to be a misspelling of
    $default_charset. It's not broken though because you misspelled it the
    same way in both places.

    2) For greater robustness you might want to check if iconv fails and
    returns false. For example, if the charset passed via decode_headers is
    invalid or not supported (I set it to 'foobar' to test), mimeDecode now
    returns an empty string, which might catch people off-guard. If iconv
    returns false you may want to leave the value either undecoded or else
    do the straight decoding as was done prior to this patch. I suppose the
    latter choice is more backward compatible.

    ------------------------------------------------------------------------

    [2011-09-27 10:20:41] alan_k

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: alan_k
    This bug has been fixed in SVN.

    If this was a documentation problem, the fix will appear on pear.php.net
    by the end of next Sunday (CET).

    If this was a problem with the pear.php.net website, the change should
    be live shortly.

    Otherwise, the fix will appear in the package's next release.

    Thank you for the report and for helping us make PEAR better.

    Can you test the changed code.

    http://svn.php.net/viewvc/pear/packages/Mail_Mime/trunk/mimeDecode.php?
    r1=317378&r2=317377&pathrev=317378&view=patch

    ------------------------------------------------------------------------

    [2011-09-27 10:02:25] alan_k

    looks like it should be optional (so as not to break BC) - (however I
    guess it is the recommended setting..)

    ------------------------------------------------------------------------

    [2011-09-27 09:59:04] dlopez

    One more clarification: I understand that you can set
    decode_headers=false so that you can do the decoding yourself... but
    then what's the point to ever setting decode_headers=true if you can't
    trust that the return value will be in an expected charset? Wouldn't it
    make more sense if decode_headers was a charset string that
    _decodeHeader() would use to iconv() the output? And then put in a case
    whereby if decode_headers=null, then it would skip any decoding (and
    conversion)?

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=18876
  • Alan at Oct 3, 2011 at 11:37 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=18876&edit=1

    ID: 18876
    Updated by: alan@akbkhome.com
    Reported By: pear at dlopez dot com
    Summary: getting attachment filename in the desired charset
    Status: Closed
    Type: Feature/Change Request
    Package: Mail_mimeDecode
    Operating System: linux
    Package Version: SVN
    PHP Version: 5.3.8
    Assigned To: alan_k
    Roadmap Versions:
    New Comment:

    Thanks, I think my eyes are going ;)


    Previous Comments:
    ------------------------------------------------------------------------

    [2011-10-03 18:27:16] dlopez

    Sorry to continue the thread... was there a reason you check the return
    value of the iconv call after the loop, but not the one inside the loop?
    I would think it should be in there as well...

    ------------------------------------------------------------------------

    [2011-10-03 07:48:24] alan_k

    Thanks, well spotted, should be fixed in svn now.

    Regards
    Alan

    ------------------------------------------------------------------------

    [2011-09-27 12:06:36] dlopez

    Holy cow, you're a superhero. I thought this feature request would be
    on a back-burner (or perhaps had some simple workaround that wasn't
    clear to me). Kudos to you.

    Preliminary testing with KOI8 content (and with decode_headers=false)
    looks good, with two notes:

    1) The second argument to _decodeHeaders appears to be a misspelling of
    $default_charset. It's not broken though because you misspelled it the
    same way in both places.

    2) For greater robustness you might want to check if iconv fails and
    returns false. For example, if the charset passed via decode_headers is
    invalid or not supported (I set it to 'foobar' to test), mimeDecode now
    returns an empty string, which might catch people off-guard. If iconv
    returns false you may want to leave the value either undecoded or else
    do the straight decoding as was done prior to this patch. I suppose the
    latter choice is more backward compatible.

    ------------------------------------------------------------------------

    [2011-09-27 10:20:41] alan_k

    -Status: Open
    +Status: Closed
    -Assigned To:
    +Assigned To: alan_k
    This bug has been fixed in SVN.

    If this was a documentation problem, the fix will appear on pear.php.net
    by the end of next Sunday (CET).

    If this was a problem with the pear.php.net website, the change should
    be live shortly.

    Otherwise, the fix will appear in the package's next release.

    Thank you for the report and for helping us make PEAR better.

    Can you test the changed code.

    http://svn.php.net/viewvc/pear/packages/Mail_Mime/trunk/mimeDecode.php?
    r1=317378&r2=317377&pathrev=317378&view=patch

    ------------------------------------------------------------------------

    [2011-09-27 10:02:25] alan_k

    looks like it should be optional (so as not to break BC) - (however I
    guess it is the recommended setting..)

    ------------------------------------------------------------------------

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=18876

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedOct 3, '11 at 5:47a
activeOct 3, '11 at 11:37p
posts3
users2
websitepear.php.net

2 users in discussion

Alan: 2 posts Pear: 1 post

People

Translate

site design / logo © 2022 Grokbase