[BUGFIX] "Illegal mix of collations" in Upgrade Wizard

When directly comparing CAST(... AS CHAR) with a CHAR field (including
VARCHAR and TEXT) whose collation isn't the same as that of the database
connection, MySQL gives an error like this:

> Illegal mix of collations (utf8_general_ci,IMPLICIT) and
> (utf8_unicode_ci,IMPLICIT) for operation '<>'

Wrapping the right side of the comparison in CAST(... AS CHAR) as well
keeps the data unchanged while ensuring that both sides have the same
collation.

Change-Id: Icaec66412d6b6441ae30065ffb92565991e9a1e4
Resolves: #36754
Releases: 6.3, 6.2
Reviewed-on: http://review.typo3.org/32198
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>