Reputation: 23
I'm facing an issue while executing this code with an utf-8 charset substr($row['titol'], 0, 50)
As soon as I encounter a letter with an accent in the last position of the string (or it seems like that) where I cut, it loses the "character information" for that accent printing me an "?" instead of the proper letter.
Ie: If my cutting position ends in "... somethingà" it would show "... something?"
as you can see, the accent is in the last char and gets weridly treated
here I deleted part of the title and it shows just fine
Upvotes: 2
Views: 90
Reputation: 926
Try with mb_substr
.
replace your code portion
substr($row['titol'], 0, 50)
to
mb_internal_encoding(“UTF-8”) // Optional
mb_substr($row['titol'], 0, 50)
Upvotes: 2