When I use substr()
I get a strange character at the end
$articleText = substr($articleText,0,500);
I have an output of 500 chars and � <--
How can iIfix this? Is it an encoding problem? My language is Greek.
When I use substr()
I get a strange character at the end
$articleText = substr($articleText,0,500);
I have an output of 500 chars and � <--
How can iIfix this? Is it an encoding problem? My language is Greek.
substr
is counting using bytes, and not characters.
greek probably means you are using some multi-byte encoding, like UTF-8 -- and counting per bytes is not quite good for those.
Maybe using mb_substr
could help, here : the mb_*
functions have been created specifically for multi-byte encodings.