Proposed change to encodeHeader()

View: New views
1 Messages — Rating Filter:   Alert me  

Proposed change to encodeHeader()

by Paul Lesniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

All,

  I was looking into a problem where encoded FROM headers weren't
being quoted, which causes problems when replying if they have a comma
in them.  US-ASCII (non-encoded) FROM headers are always encased in
quotes for this very reason I believe (in case a comma is found
within).

  It depends on the charset/encoding in question (any language can
provide its own encoding via XTRA_CODE in the language setup (I didn't
check those routines), and other multibyte character sets use the
encodeHeaderBase64() function), but if the code in encodeHeader() is
used, quotes around the full name part of the email address can cause
problems because they are not always encoded.  I didn't dissect the
code in this function (which is why I'm asking), but found that adding
a simple test for quotes "fixes" this issue.

--- functions/mime.php  (revision 13833)
+++ functions/mime.php  (working copy)
@@ -789,6 +789,7 @@
     for($i = 0; $i < $j; ++$i) {
         switch($string{$i})
         {
+            case '"':
             case '=':
             case '<':
             case '>':

  What I'd like to know is what the consequences are of making this
change - does this have possible large effects on anything else?  Or
is it just a matter of performance (the function seems to try to be as
"ungreedy" as possible, only encoding things that don't have 8-bit
characters in them)?  Please see the full patch attached to this
message that puts quotes around encoded full name-style FROM headers.
See also the two bug reports about this problem:

http://thread.gmane.org/gmane.mail.squirrelmail.user/36501
https://sourceforge.net/tracker/index.php?func=detail&aid=2830141&group_id=311&atid=100311

  Thanks,

Paul

--
Paul Lesniewski
SquirrelMail Team
Please support Open Source Software by donating to SquirrelMail!
http://squirrelmail.org/donate_paul_lesniewski.php


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: squirrelmail-devel@...
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel

quote_encoded_addresses.diff (2K) Download Attachment