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 I fix this? Is it an encoding problem? My language is Greek.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
substris 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_substrcould help, here : themb_*functions have been created specifically for multi-byte encodings.