joomla/joomla-cms — pull request #2092 by pollen8 (2013-09-30 10:36:35+00:00)
Title: MySQL(i) db collation check was not actually querying the database default collation

This patch checks the actual db collation first, and if not found falls back to the previous method of querying the first db table's first column's collation.
Issue with the previous method is that if you had a table with a field whose collation was not the same as the db's default collation the method would return the wrong result.