Forum Discussion
2 Replies
- tstackFormer Employee
The next release of the platform will have an expression language function for converting characters to their HTML entities. Until then, I think most people use replace() to do the substitution on the string, like so:
$msg.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>')
Or, the slightly fancier:
$msg.replace(/&|<|>/g, m => match m { '&' => '&', '<' => '<', '>' => '>' })
- SteveAdmin
Have you tried using the encodeURIComponent() function? E.g. encodeURIComponent(“sam & max”)