Forum Discussion

BekaD12's avatar
BekaD12
Helper
5 years ago

Emoji and truncate

Hi all,

from this :https://developer.khoros.com/khoroscommunitydevdocs/reference/utils-for-manipulating-and-stripping-html

I try to use the allow allowElement combined with the html.truncate.

My problem is whenever emoji are inside my html, they don't display.

Did someone have a solution ?

My code :

<#assign messageId = 2505 />
<#assign response = restApiV2Utils.doQuery("SELECT id, subject, body FROM messages WHERE id = '${messageId}'") />

<#assign stripperOptions = utils.html.stripper.from.owasp.optionsBuilder
.allowElement("p")
.allowElement("span")
.allowElement("img")
.build() />
<#assign strippedBody = utils.html.stripper.from.owasp.strip(messages.body, stripperOptions) />
<p class="truncate">${utils.html.truncate(250, strippedBody, "...")}</p> 

alexandraG Widade_H   

No RepliesBe the first to reply