On Mon, 1 Jun 2009 12:44:35 -0500, chasd <[email protected]> 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.



-- 
Eric Stadtherr
[email protected]
_______________________________________________
List info: http://lists.roundcube.net/dev/

Reply via email to