This question has already been answered:

The abbreviation of the Russian text is incorrectly displayed, namely, after the abbreviation, the "question" symbol appears.

enter image description here

Reported as a duplicate by participants aleksandr barakin , Alexey Shimansky , br3t , AK , Pavel Mayorov Aug 16 '17 at 7:29 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • 3
    Attach the source code in which the text is reduced. - Artyomich

1 answer 1

The text is cut to length without considering the multi-byte encoding. Most likely your strings are stored in UTF-8, and cropping is done by length in bytes. As a result, the last character loses one or two bytes, and the placeholder symbol is displayed instead.

You should rewrite the trim function so that it takes into account multibyte characters, for example using the functions mb_substr() or iconv_substr()

See also:

  1. http://php.net/manual/ru/function.mb-substr.php
  2. http://php.net/manual/ru/function.iconv-substr.php
  • and what can I do about it - Mike Nazar
  • 1. Re-formulate the question (you can edit it) - give examples in text form and remove the picture; - tutankhamun