On Mon, Jun 1, 2009 at 8:34 PM, Eric Stadtherr estadtherr@gmail.com wrote:
On Mon, 1 Jun 2009 12:44:35 -0500, chasd chasd@silveroaks.com wrote:
On Jun 1, 2009, at 11:25 AM, Eric Stadtherr wrote:
// Workaround for mail agents that include Windows-1252 characters // in text advertised as ISO-8859-1 if ($from == "ISO-8859-1" && preg_match("/[\x80-\x9F]/", $str)) $from = "WINDOWS-1252";
Since $str can be very large, isn't there a performance / resource penalty to the preg_match in order to compensate for a mistake that is outside of RoundCube ?
Yes, this may help you with this particular sender, but the potential is for each and every RoundCube user to pay this performance price processing each and every message. Maybe my old-school sensibilities are too worried about CPU time with today's CPUs.
At least preg_match stops after first encountering the search string. I guess the worst case is a large iso-8859-1 part that is truly iso-8859-1 and preg_match has to search the whole thing.
The other option (and this is *shudder* recommended in the HTML 5 RFC) is to just always decode iso-8859-1 strings as windows-1252.
And what's the performance trade off to always converting?
Maybe we open an issue and keep trac(k) of the problem. If more people have the same issue, then we should think about fixing it. My proposal in this case would be to tell them [the event organizer] that there's an obvious flaw in their mailings which prevents their customer from viewing it.
I personally don't really want to fix other people's issues and make RoundCube slower. Doesn't sound like win, win. ;-)
Till _______________________________________________ List info: http://lists.roundcube.net/dev/