Incorrect displaying of message html part
|Reported by:||Javer||Owned by:|
When RoundCube shows message, it uses WashHtml? for cleaning html part of message. But if html part of message does not contain <head> and <meta> charset tags (as it also creates RoundCube), calling DOMDocument->loadHTML(), which used in washtml::wash(), result in corrupted content, because it encode in UTF8 already UTF8-encoded content. Bug are visible when international symbols are used in message body, otherwise UT8-encoding does nothing.
PHP Manual on DOMDocument->loadHTML() wrote:
Pay attention when loading html that has a different charset than iso-8859-1. Since this method does not actively try to figure out what the html you are trying to load is encoded in (like most browsers do), you have to specify it in the html head. If, for instance, your html is in utf-8, make sure you have a meta tag in the html's head section
This patch checks presence of meta charset tag before cleaning, and if it isn't present - add meta charset before </head> tag if it is present, otherwise at start of content.