Search Replace DB and character set issue

When working with the Search Replace DB tool, character set mismatches can lead to unexpected results during search and replace operations. Here are some steps to resolve these issues:

Step 1: Check the character set in all tables in your database

source .env && \
docker exec -it ${DB_INSTANCE} \
mysql --user="${DB_USER}" --password="${DB_PASSWORD}" \
-e "SELECT CCSA.character_set_name, table_name
FROM information_schema.\`TABLES\` T, information_schema.\`COLLATION_CHARACTER_SET_APPLICABILITY\` CCSA
WHERE CCSA.collation_name = T.table_collation AND T.table_schema = 'your_database';"

Step 2: Exclude tables that may cause errors

source .env && \
docker exec -it ${DB_INSTANCE} \
php Search-Replace-DB/srdb.cli.php -h ${DB_HOST} -n ${DB_DATABASE} \
-u=${DB_USER} -p=${DB_PASSWORD} \
-s "${SEARCH_STRING}" -r "${REPLACE_STRING}" \
-w table_1,table_2,table_3

In the above command, we will exclude table_1, table_2 and table_3 from the replace operation. If set excludes the specified tables, use a comma separate for multiple values and no white space between them.