I don’t know if you can do it, but
UPDATE `table` SET column = replace(column, REGEXP '[\x00-\x1F\x80-\xFF]', '');
Make sure you run this as your first choice or make it in a temporary sandbox. I do not know if this is legal in mysql.
I know that there are third-party regular expression libraries that can do this, but require a change to your db. I do not know how this works.
EDIT
You better write a small php script to do this for you. The above regex will work to strip out garbage characters.
$data = preg_replace_all('/[\x00-\x1F\x80-\xFF]/', '', $data);
Once again, if this was unclear before: DON'T FAST AHEAD IN MY SELECTION OF SQL STATEMENT, as I have no idea what will actually happen.
source
share