Handling all Special Characters in RTE validation

Certified Associate Developer

Hello, 

We have Rich Text Editor to take input from user which can contain special character . We are using stripHtml() to get the text and later on we are comparing the text with Regex to show validation on RTE.

The issue we are facing with stripHtml() is that it is leaving some characters as html encoded in the returned text. But we require the character itself.

How can we handle such case for all the special characters? 

For reference -


In the output, the special character ( š ) is coming as html encoded whereas the other character which  is <, can be compared using regex.

We need the output as - "š<"

How to handle all the such characters which will be coming as html encoded? Is there any other function which we can use to achieve the above result ?

  Discussion posts and replies are publicly visible