6.0.0-beta1
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
11/27/25
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#9187] compose html2text charset
*
Your Email Address
*
Spam protection
Enter the letters below:
.___..__ .__ .__.. . | [__)[ __[__]|\ | | | \[_./| || \|
Comment
> $_prefs['compose_html']['value'] => 1 > $mime_drivers['html']['inline'] => true, > php-5.3.2 > Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 > > > When clicking on "Switch to plain text composition", I get no text. > > Fix : > imp/lib/Ui/Compose.php:384 > -- return $msg . "\n" . $sig; > ++ return $data . "\n" . $sig; > > > I have a second issue when switching from html 2 text composition, > accent get screwed. It appears to come from DOMDocument not being > able to detect properly the charset. > > The following fix does the job for me (inspired from "User > Contributed Notes" > http://www.php.net/manual/en/domdocument.loadhtml.php) > > --- Html2text.php 2010-07-27 10:20:23.000000000 +0200 > +++ > /var/www/html/horde/libs/Horde/Text/Filter/Html2text.php 2010-08-19 > 12:38:34.000000000 +0200 > @@ -102,16 +102,22 @@ > public function postProcess($text) > { > if (extension_loaded('dom')) { > - $text = Horde_String::convertCharset($text, > $this->_params['charset'], 'UTF-8'); > + if ($this->_params['charset'] != 'UTF-8') { > + $text = Horde_String::convertCharset($text, > $this->_params['charset'], 'UTF-8'); > + } > > $old_error = libxml_use_internal_errors(true); > $doc = new DOMDocument(); > - $doc->loadHTML('<?xml encoding="UTF-8">' . $text); > + $doc->loadHTML('<?xml encoding="UTF-8">' . > mb_convert_encoding($text, 'HTML-ENTITIES', "UTF-8")); > if ($old_error) { > libxml_use_internal_errors(false); > } > > - $text = Horde_String::convertCharset($this->_node($doc, > $doc), 'UTF-8', $this->_params['charset']); > + if ($this->_params['charset'] != 'UTF-8') { > + $text = > Horde_String::convertCharset($this->_node($doc, $doc), 'UTF-8', > $this->_params['charset']); > + } else { > + $text = $this->_node($doc, $doc); > + } > } >
Attachment
Watch this ticket
N
ew Ticket
M
y Tickets
S
earch
Q
uery Builder
R
eports
Saved Queries
Open Bugs
Bugs waiting for Feedback
Open Bugs in Releases
Open Enhancements
Enhancements waiting for Feedback
Bugs with Patches
Enhancements with Patches
Release Showstoppers
Stalled Tickets
New Tickets
Horde 5 Showstoppers