[imp] Preview, Reply and Forward windows broken with certain mail messages

Michael M Slusarz slusarz at horde.org
Fri May 17 19:28:04 UTC 2013


Quoting Ruben Squartini <ruben at auger.org.ar>:

> The Horde_Utils package turned from 2.2.1 to 2.2.2, now it shows one  
> of the messages (the one that is only text) as a text block (not  
> more "Unable to view message...") in the preview window, but nothing  
> is shown in the reply or forward windows (until I uncheck the "HTML  
> composition" checkbox).
>
> I don't know if I can send attachments through the list, if they  
> fail I'll send them directly to your address. I hope this can help  
> solve the problem.

The problem is that the message is sent in ISO-8859-1, but the MIME  
headers report that the message is in UTF-8.  PHP's htmlspecialchars()  
is very fussy about charsets - if you give it the wrong information,  
it returns a blank string.  The ENT_SUBSTITUTE flag to the function  
would be useful, but it is only supported as of PHP 5.4  
(http://php.net/htmlspecialchars).

I guess we can do the same hack as we do with malformed headers in  
that we cycle through the two most common charset options, at least  
for Western locales (ISO-8859-1/Windows-1252 and UTF-8), to attempt.   
But at some point, Garbage in = Garbage Out.  So there is a chance  
that a message will continue to be undisplayable, since it is  
impractical to attempt to convert from every charset known to man.

Although we should probably be smarter about displaying a warning in  
IMP if the resulting string is empty, but the initial data input was  
not.

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the imp mailing list