I have the following line in my code :
mb_substr(strip_tags($comm->getRawValue()->comment),0,30,'UTF-8')
This allows me to display only the first 30 chars of a comment.
But when the comment contains an accent at that string position, the
output is :
"Ah non, on ne peut pas int&eac"
An html entity gets cut.
The weird behavior here is that, if I cut the string farther from the
start, it gets displayed as :
"Ah non, on ne peut pas intég"
With no html entities, just the character ‘é’.
What is going on ?
PS_ I tried adding a html_entity_decode(), but that transforms the accent in question marks.
Got it !
I had to add ‘UTF-8’ to html_entity_decode :