Opened 5 years ago
Closed 5 years ago
#1485110 closed Feature Patches (fixed)
Incorrect displaying of message html part
| Reported by: | Javer | Owned by: | |
|---|---|---|---|
| Priority: | 2 | Milestone: | 0.2-alpha |
| Component: | PHP backend | Version: | git-master |
| Severity: | major | Keywords: | |
| Cc: |
Description
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.
Attachments (1)
Change History (2)
Changed 5 years ago by Javer
comment:1 Changed 5 years ago by alec
- Resolution set to fixed
- Status changed from new to closed

Fixed in [32b70927].