I receive from the server through curl the data in utf.

The server likes to shorten the text by simply cutting the string byte by bit, so the text is full at the ends of the line, after which there is a three-point

If I take this text through curl and give it to the regular, the regular will refuse to process it.

$ return = str_replace ("", "", $ return); did not remove problem areas

$ return = mb_convert_encoding ($ return, 'UTF-8', 'UTF-8'); partly helped, but now in the text began to slip conomic ئ nbsp; .., which also does not chew on regular basis

  • Start by writing code to send / receive data - Arendach

1 answer 1

Try through preg_replace('/( )/', '', $input_lines); .
working example - https://www.phpliveregex.com/p/q2v

http://php.net/manual/ru/function.preg-replace.php

  • 2
    I think it's better to work with multibyte strings, rather than correct the consequences of an error (instead of avoiding it). - Mikhail Rebrov
  • I completely agree)) - BravOFF