I change the encoding of a large text (2-3Mb):

$content = iconv('UTF-8', 'CP1251', $content); 

as a result, the text was cut off constantly at a certain place, I learned about IGNORE, rewrote it in:

 $content = iconv('UTF-8', 'CP1251//IGNORE', $content); 

on the home server earned, there is no hosting.

What could be the problem? Or if you do not understand how it can be circumvented?

    1 answer 1

    Solved the problem using another function: mb_convert_encoding

     $content = mb_convert_encoding($content, 'CP1251', 'UTF-8');