Can't mysql autocast encoding in query data?
There are good explanations why MySQL can't do it automatically:

https://stackoverflow.com/a/12260863/1261575

https://stackoverflow.com/a/21061305/1261575