added character set support for MySQL query