问题描述:

I have the problem that my installed FCKEditor 3.3.1 changes all & to &.

I am posting lots of links in my posts and this makes them invalid. Where can I define that & ist NOT replaced with &?

Thanks :-)

网友答案:

See the custom setting in the fckconfig.js file for FCKeditor.

FCKConfig.ForceSimpleAmpersand  = true ;

Tomalak is correct about how it should be presented but I'm just pointing out that there is a configuration option in FCKeditor, in case you need to "break the rules". There are situations where this is necessary. Rendering the ampersand as a true HTML entity (&) does not work in some HTML mail clients, which rarely adhere to HTML standards properly anyway. And you may need to force the plain ampersand if you have an additional filter that will convert it to an HTML entity further along your process.

网友答案:

No, you can't. FCKEditor does the right thing.

There is no situation where a standalone & in HTML is not an error. The ampersand always has to be encoded as & - unless it is the start of an escape sequence itself (like in <).

It is a misconception that the & in the HTML source code would make a link invalid. It does not. For HTML to be valid, all data in it must be HTML-escaped. "Data" means both text (in-between tags) and attribute values (like href). When the HTML source is then parsed, the parser will automatically HTML-unescape all data and & will become & again in the DOM. Do not let the fact that many browsers accept an unescaped ampersand deceive you. It is wrong nevertheless (and FCKEditor just tries to deliver valid HTML).

相关阅读:
Top