Incorrect string value error running upgrade script

Hi all,

I’m in the process of upgrading RT from 3.6 to 5.0. I got as far as running the SQL queries to update the db schema:

mysql -u root -p rt5 < queries.sql

It fails with some variation of:

ERROR 1366 (HY000) at line 20: Incorrect string value: ‘\xF0\x9F\x91\x8D A…’ for column ‘Subject’ at row 583492

I’ve determined that this is caused by some spam emails that have emoji characters in them. Finding and removing them manually is incredibly tedious - is there a better way?

Thanks,
Adam

I see a lot of suggestions here but none of them are necessarily “agreed” upon as the right solution

Thanks. Looks a bit over my head at this point.
I’ve managed to find them by a combination of filtering and trolling through the table the hard way, and compiling a list of records to alter. Very time consuming but still a lot better than what I was doing.