PDA

View Full Version : htmleditor adding characters



frrogoy
12 Feb 2010, 6:36 AM
The form htmleditor adds an html br after the text. I can live with that. But sometimes I'm getting a funny character that is causing me a problem.

Now I'm adding a second note.​

I'll also attach a picture in case the above doesn't display.
Using FF and Ext3.1. The funny chars appear in the database (MySQL).
In the picture you can see it got added in the middle of the line in one case.

FlyFoxUK
20 Mar 2010, 5:57 AM
Is there a solution to this problem?

thomasmckay
26 Feb 2011, 5:26 AM
Submitted bug: http://www.sencha.com/forum/showthread.php?125187-HtmlEditor.getValue%28%29-inserting-unprintable-characters&p=575311

Did you ever find a work-around or solution?

frrogoy
28 Feb 2011, 10:46 AM
Never got a total solutions. The problem is worst if I have to email something that was formerly entered via the htmleditor.
I'm avoiding them and just using textareas now, unless the customer insists.
I use the following calls before putting the text in emails. It gets most of it out.

$mailer->Body .= strip_tags(decode_entities($n['note']));
function decode_entities($text) {
$text= html_entity_decode($text,ENT_QUOTES,"ISO-8859-1"); #NOTE: UTF-8 does not work!
$text= preg_replace('/&#(\d+);/me',"chr(\\1)",$text); #decimal notation
$text= preg_replace('/&#x([a-f0-9]+);/mei',"chr(0x\\1)",$text); #hex notation
return $text;
}

thomasmckay
28 Feb 2011, 11:06 AM
The reply in the bug thread worked for me. Give it a try.

frrogoy
28 Feb 2011, 11:15 AM
Thanks. I'll try it. I assume it goes in the js module where the htmleditor is used...