Project

General

Profile

Actions

Bug #16341

closed

Entities entered in wysiwyg are decoded and therefore gone when toggling to html source or saving

Added by Uschi Renziehausen over 18 years ago. Updated over 16 years ago.

Status:
Closed
Priority:
Should have
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2006-07-12
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Version info: 1.4.1 demo mode with some adaptions in page tsconfig

If you want to use the RTE for documentation purposes, you might need to talk about entities, but they get decoded when toggling to htmlCode view and on save.
- in whysiwyg enter <
- toggle to htmlCode view and you see < where it should be <
- toggle back whysiwyg and you see <

The same destructive behaviour is observed on
- entering < in wysiwyg-mode
- then pressing save

I found out where this happens :-)

The thief of my entitities is to be found in HTMLArea.htmlEncode = function(str). Before the entities get encoded, they get decoded:
str = HTMLArea.htmlDecode(str);

If you comment out this line, the entities are kept, provided that the parser is configured properly (see additional information).

Prosit, Uschi

HTMLArea.htmlEncode = function(str) {
if (typeof(str) != 'string') str = str.toString(); // we don't need regexp for that, but.. so be it for now.
// Let's not do it twice
// str = HTMLArea.htmlDecode(str);
str = str.replace(/&/g, "&");
str = str.replace(/</g, "<").replace(/>/g, ">");
str = str.replace(/\xA0/g, " "); // Decimal 160, non-breaking-space
str = str.replace(/\x22/g, """); // \x22 means '"'
str = str.replace(HTMLArea.Reg_entities, "&$1;"); // keep numeric entities
return str;
};

Parser configuration:

  1. default, see res/proc/pageTSConfig.txt
    RTE.default.proc.entryHTMLparser_db.htmlSpecialChars = 0
  1. my config
  1. If this is not set, the entities are destroyed by the central parser even after
  2. you comment out the str = HTMLArea.htmlDecode(str);
    RTE.default.proc.exitHTMLparser_rte = 1
    RTE.default.proc.exitHTMLparser_rte.htmlSpecialChars = -1

(issue imported from #M3830)


Files

rtehtmlarea_bugfix_5659.patch (1.89 KB) rtehtmlarea_bugfix_5659.patch Administrator Admin, 2008-02-07 06:01

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #17319: Several bugs when writing HTML entities and tags inside of RTEClosedStanislas Rolland2007-05-20

Actions
Actions #1

Updated by Uschi Renziehausen over 18 years ago

I just realised that there are to more things to change in RTE.default.proc, because otherwise the main parser will destroy entities inside

!

Here again the full list:

RTE.default.proc.entryHTMLparser_db.htmlSpecialChars = 0
RTE.default.proc.entryHTMLparser_rte = 1
RTE.default.proc.exitHTMLparser_rte = 1
RTE.default.proc.entryHTMLparser_rte.htmlSpecialChars = 1
RTE.default.proc.dontHSC_rte = 1
RTE.default.proc.exitHTMLparser_rte.htmlSpecialChars = -1

Actions #2

Updated by Dmitry Pikhno over 18 years ago

i am not sure if this bug has relation to my but... anyway

it is not possible to insert presentation of tag in text. for example:

text "tag for links is <a>" in whysiwyg converted to "tag for links is"
and source shows "tag for links is <a rtekeep=1></a>" instead of "tag for links is <a>". it happens after saving.

Actions #3

Updated by Stanislas Rolland almost 17 years ago

I would think that if you use htmlArea RTE 1.5.4+ (it would probably work also with older versions) and if you use the default processing options (that is: if you do not override any part of RTE.default.proc in Page TSConfig), then all you need to do is add the following two lines to Page TSConfig:

RTE.default.proc.dontUndoHSC_db = 1
RTE.default.proc.dontHSC_rte = 1

Actions #4

Updated by Stanislas Rolland almost 17 years ago

See related issue #5659 for patch.

Fixed in SVN TYPO3core branches trunk and TYPO3_4-2.

Actions

Also available in: Atom PDF