Problem solved.
I updated the php version to 7.4
Thanks for your help.
I applied your changes to a new installation and did not correct the problem.
I have another site where this works well and it has some tables in utf8mb4-unicode-ci and others in utf8mb4-unicode-520-ci. this website is not new and has had automatic updates.