How to change the collation for all tables

This has been a pain in my dairies.
I finally came up with a script to run and it converts 98% of the tables.
Drop this file into the interface folder and access it from the browser.
https://mysite.com/interface/upgrade_collation.php

upgrade_collation.php (728 Bytes)

The reason for the 98% is that there are some tables that won’t convert if they have illegal columns and such like. There are other that just won’t convert. No reason found yet.

UPDATE
@brady.miller
I updated the script to set the collation of the database also. When I checked back in the system we had upgraded. The collation was still set to latan1. Doing some reading on the Mysql documentation. Latan1 is the default collation if none is specified when creating the database.

Now our procedure for upgrading from v5 and below, will be to run this script before running the database upgrade script to set the collation for both the database and tables.