I'm calling an API that return me an invalid character and when I try to save it in DB I get this error
"message": "SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\\xC2\\x96 Str...' for column 'name' at row 1 (SQL: insert into `discounts` (`id_external`, `location_id`, `status`, `created_by`, `created_on`, `created_datetime`, `name`, `pos_id`, `max_amount`, `max_percent`, `min_amount`, `min_percent`, `min_ticket_total`, `open`, `type`, `value`, `last_datetime`) values (p446, 277864, 1, 2, 1, 2022-05-20 23:22:55, VOC StrwShrCk, p446, 1000, ?, ?, ?, ?, 0, percent, 10000, 2022-05-20 23:22:55))",
So I want to strip invalid characters from a string