Expand my Community achievements bar.

SOLVED

AEM Sightly - Special characters not displaying properly in view source for RTE

Avatar

Level 2

Hi Team,

I have a requirement where user inputs <%= formatDate(new Date(), "%2D.%2M.%4Y") %> in RTE.

If I check the view page source, the data is rendered as &lt;%= formatDate(new Date(), &quot;%2D.%2M.%4Y&quot;) %&gt;

Desired result is <%= formatDate(new Date(), "%2D.%2M.%4Y") %>

I tried adding context = 'unsafe' but it is not working for RTE although the context works like a charm for textfield or pathfield.

Is there a way to get the expected result in RTE as well?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

I think when user input text in RTE , the character encoding is applied thats why your function is traded as text.

What you can do, you can read RTE text value using java and decode and return in HTL.



Arun Patidar

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi,

I think when user input text in RTE , the character encoding is applied thats why your function is traded as text.

What you can do, you can read RTE text value using java and decode and return in HTL.



Arun Patidar

Avatar

Level 2

Thank you Arun. The solution works