The original code for which everything works as expected. There is a certain line $finded , I make the first letter big and add to the database.
//делаем первую буква большой $char = mb_strtoupper(substr($finded, 0, 2), "utf-8"); // это первый символ $finded[0] = $char[0]; $finded[1] = $char[1]; //второй //далее вставляем в базу $this->db->insert($sql, $params); Then he added the cleaning of multiple spaces in $finded and the PDO reports an error, the encoding incompatibility is apparently
array(3) { [0]=> string(5) "HY000" [1]=> int(1366) [2]=> string(82) "Incorrect string value: '\x9E\xD1\x82\xD0\xBF\xD1...' for column 'status' at row 1" } This is done before the code above, the modifier u in the regulars does not help
$finded = preg_replace('/\s\s+/isu', ' ', $finded); What is wrong here?
'\x9E\xD1\x82\xD0\xBF\xDyou have lost the first byte\xD0. - Visman