Fix for undefined array index in some situations.
Added sql_set_charset()