View Full Version : handling special characters in html editor

21 Feb 2010, 8:19 AM

I entered this in the 2.0 forum before realising that it would only be seen by people still watching version 2.

Hence, I copy it here with my apologies in case that it would create inconvenience. But I think that the question is still valid:

Hello, I'm facing a problem with the html editor.
I supposed to receive pure html server side, so any character would be converted into its html code.
Actually, I receive just SOME characters encoded (e.g. < >) but not others.
This cause me problems, because doing the html encoding server side will also encode the SOME html-codes the editor decided to encode.
The euro character is also received as a bad character server side.
How could I be sure to have the editor encode EVERY special character?
I understand that the editor needs to encode < > chars to be sure to handle html formatting while editing, but, in case, I would need to know the exact sequence of chars it will surely encode, so that I may write a server side encoding for the remaining chars.

Thanx a lot,

I have the same problem:((

I can't figure out how I can type e name like "O'Neill" in a htmleditor or textfield without having to escape the ' manually with an \

Is there any progress on this?

Or does anyone have a good example on:

- entering text including special characters in a form with a text field and html editor,

- send this with JSON to the server

- enter it in a mysql dbase with php

- send it back into a extjs front end with PHP

I am able to do all this as long as there are no special charactes involved

Thanks for all assistance ;-)

7 Oct 2010, 12:07 AM
I use 3.2.1 and have a similair problem.

The other thread I found:

We use parameters inside the url for our secure file mechanism thus: index.php?bla=bla&id=234534534 something like that.
After using the function insertAtCurser all the & signs get turned into & which causes the image to go 404.

I have studied the documentation and have found no simple way to turn it off or a parameter on the insertAfterCursor that prevents any encoding from occururing.

So is this default behaviour and is their nothing to do about it?

After more testing and searching I found that it doesn't matter how you insert the & it always gets converted to &
I have tried the demo of TinyMCE and it does the same thing. These editors just can't seam handle rawly outputting characters stated above. If ANYONE can shed some light on this issue, please comment.

7 Oct 2010, 3:37 AM
Are you sure you are doing this correctly? Can you post an example of the problem?

7 Oct 2010, 3:51 AM
This is the HTML editor

this.contentField=new Ext.form.HtmlEditor({
enableColors: true,
enableFontSize: true,
enableFont: false,
enableLinks: true,
enableLists: false,
enableAlignments: true,
this.addImageHtmlButton=new Ext.ux.form.HtmlEditor.Image()
})I will not bore you with the whole plugin that is inserted, but what it eventually does is this.
this.cmp.insertAtCursor('<img src="'+img.src+'" title="'+img.name+'" alt="'+img.name+'">');
When I press the image button.

where img.src is something like index.php?type=file&id=2135

You can easily test this behaviour by typing a & character in to a simple html editor and press the check source button.
It goes the same if you insert an url with this markup. It adds &amp;

Additionally, when I alert the complete url just before it's inserted it gives the & if I get it back from the editor immediately after they all turned in to &amp;

When I use an URL it does make it &amp; but for some reason it still works in the front end. Images with these tags in them do not work.