it sounds like you have special characters in your query that will cause problems if you don't set the correct encoding, which should be used to send the SQL query to the server. if you do not run "set names", the default value is used - and this seems wrong.
for more information, see the documentation
source
share